Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Update Views

This section covers a set of web services to update a Yellowfin view. These work in conjunction with one another and must be used in the following sequence:

...

Expand
titleComplete code example

Complete example of View web services

Below is a full example of the EDITVIEW, ADDCOLUMNTOVIEW, and PUBLISHVIEW web services. (Contained in a single file, as they are meant to be used together.) To use it for yourself, carry out the following the steps:

  1. Copy the code and save it as ws_editview.jsp.

  2. Put the file in the root folder, which is Yellowfin/appserver/webapps/ROOT.

  3. Adjust host, port, admin user and user to add details according to your environment.

  4. Run http://<host>:<port>/ws_editview.jsp from your Internet browser.


Code Block
languagejava
themeEclipse

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="java.text.*" %> 
<%@ page import="java.util.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
<%@ page import="com.hof.mi.web.service.schedule.*" %>
<%@ page import="com.hof.data.*" %>
<%@ page import="com.hof.util.*" %>
<%@ page import="com.hof.web.form.*" %>
<html>
<body>
<%
String userId = "admin@yellowfin.com.au";
String password = "test";
String cliOrgRef = null;
%>
<%
   String baseuri = request.getRequestURI();
   int index = baseuri.lastIndexOf('/');
   if (index >= 0) baseuri = baseuri.substring(0, index);
   String self = request.getServletPath();
   self = self.substring(self.lastIndexOf('/') + 1);
   self = baseuri + "/" + self;
%>
<form action="<%=self%>" method="post">
	<input type="hidden" name="cmd" value="editView" />
	<h3>Edit View</h3>
	<input type="text" name="editViewId" />
	<input type="submit" />
</form>
<%
	AdministrationServiceResponse rs = null;
	AdministrationServiceRequest rsr = new AdministrationServiceRequest();
	AdministrationServiceService ts = new AdministrationServiceServiceLocator("localhost", 8080, "/services/AdministrationService", false);
	AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService();
	   
	String cmd = request.getParameter("cmd");
	String viewID = "";
	
	/*
	* Place the view into DRAFT mode to enable web service editing
	*/
	if ("editView".equals(cmd)) {
		viewID = request.getParameter("editViewId");	
		rsr.setLoginId(userId);
		rsr.setPassword(password);
		rsr.setOrgId(new Integer(1));
		
		//Client organization the specified view can be found in
		rsr.setOrgRef(cliOrgRef);
		rsr.setFunction("EDITVIEW");
		if (viewID!=""){
			
			//ViewId of the primary view entry
			
			rsr.setViewId(new Integer(viewID));
		}
		rs = rssbs.remoteAdministrationCall(rsr);
		
		if ("SUCCESS".equals(rs.getStatusCode())) {
			out.write("Success");
		} else {
			out.write("Failure");
		}	
	}
%>
<br><br>
<form action="<%=self%>" method="post">
	<input type="hidden" name="cmd" value="addView" />
	<h3>Add Column to View</h3>
	ViewID: <input type="text" name="addViewId" /><br><br>
	Database Table Name: <input type="text" name="addTableName" /> Column Name: <input type="text" name="addColName" /><br><br>
	Field Name: <input type="text" name="addFieldName" /><br>
	Field Description: <input type="text" name="addFieldDesc" /><br>
	Field Category: <input type="text" name="addFieldCat" /><br>
	<input type="submit" />
</form>
<%
	cmd = request.getParameter("cmd");
	viewID = "";
	String dbTbl="";
	String dbCol="";
	String fieldName="";
	String fieldDesc="";
	String fieldCat="";
	if ("addView".equals(cmd)) {
		viewID = request.getParameter("addViewId");
		dbTbl = request.getParameter("addTableName");
		dbCol = request.getParameter("addColName");
		fieldName =  new String(request.getParameter("addFieldName").getBytes("iso-8859-1"),"UTF-8");
		fieldDesc = new String(request.getParameter("addFieldDesc").getBytes("iso-8859-1"),"UTF-8");
		fieldCat = new String(request.getParameter("addFieldCat").getBytes("iso-8859-1"), "UTF-8");
		rsr = new AdministrationServiceRequest();
		
		/*
		* Web service function to add a database column into a currently existing view.
		*/
		
		rsr.setLoginId(userId);
		rsr.setPassword(password);
		rsr.setOrgId(new Integer(1));
		rsr.setOrgRef(cliOrgRef);
		rsr.setFunction("ADDCOLUMNTOVIEW");
		if (viewID!=""){
			rsr.setViewId(new Integer(viewID));
		}
		AdministrationViewField field = new AdministrationViewField();
		field.setShortDescription(fieldName);
		field.setLongDescription(fieldDesc);
		field.setFieldCategory(fieldCat);
		rsr.setField(field);
		rsr.setParameters(new String[]{dbTbl, dbCol});
		rs = rssbs.remoteAdministrationCall(rsr);
	   
		if ("SUCCESS".equals(rs.getStatusCode())) {
			out.write("Success");
		} else {
			out.write("Failure");
		}	
	}
%>
<br><br>

<form action="<%=self%>" method="post">
	<input type="hidden" name="cmd" value="publishView" />
	<h3>Publish View</h3>
	<input type="text" name="publishViewId" />
	<input type="submit" />
</form>
<%
	cmd = request.getParameter("cmd");
	viewID = "";
	
	/*
	*After all changes have been made, publish the view.
	*/
	
	if ("publishView".equals(cmd)) {
		viewID = request.getParameter("publishViewId");
		rsr = new AdministrationServiceRequest();
		rsr.setLoginId(userId);
		rsr.setPassword(password);
		rsr.setOrgId(new Integer(1));
		rsr.setOrgRef(cliOrgRef);
		rsr.setFunction("PUBLISHVIEW");
		if (viewID!=""){
			rsr.setViewId(new Integer(viewID));
		}
		rs = rssbs.remoteAdministrationCall(rsr);
		 
		if ("SUCCESS".equals(rs.getStatusCode())) {
			out.write("Success");
		} else {
			out.write("Failure");
		}	
	}
%>






Other

Expand
titleDELETEVIEW

This web service is used to delete a view in Yellowfin. You can specify the view by providing either its ID or UUID.

 

Request Parameters

The following parameters should be passed with this request:

Request Element

Data Type

Description

LoginId

String

An admin account to connect to Yellowfin web services. This can be the user ID or the email address, depending on the Logon ID method.

This account must have the “web services” role enabled, and must belong to the default (i.e. primary) org.

Password

String

Password of the above account.

OrgId

Integer

Default (i.e. primary) organization ID within Yellowfin. Always set this to 1.

Function

String

Web service function. Set this to "DELETEVIEW".

ParametersString[]

The ID or UUID of the view that is to be deleted.

 

 

Response Parameters

The returned response will contain these parameters:

Response Element

Data Type

Description

StatusCode

String

Status of the web service call. Possible values include:

  • SUCCESS
  • FAILURE

 

Instructions

See below for step-by-step instructions on how to perform this call, using a Java example:

Expand
titleStep-by-step instructions
  • Define the request for this function, which includes logging in as the admin user and specifying the web service call to perform:

    Code Block
    languagejava
    themeConfluence
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(new Integer(1));
    
    rsr.setFunction("DELETEVIEW");


  • Specify the view to be deleted by providing its ID or UUID:

     

    Code Block
    languagejava
    rsr.setParameters(new String[] {
         "70103"
    });

     

     

  • Once the request is configured, perform the call:

    Code Block
    languagejava
    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

    Initialize the Administration web service. Click here to learn how to do this. 

 

  • The response will contain the StatusCode. (See details in the Response Parameters table above.)

     

 

 

Complete Example

Below is a full example of this web service call. To use it for yourself, carry out the following the steps:

  1. Copy the code and save it as ws_deleteview.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, and admin user details according to your environment.
  4. Run http://<host>:<port>/ws_deleteview.jsp from your Internet browser.

 

Code Block
languagejava
themeEclipse
<%   	
/*    		ws_deleteview.jsp              	*/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hof.util.*, java.util.*, java.text.*" %>
<%@ page import="com.hof.web.form.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
 
	AdministrationServiceResponse rs = null;
    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    AdministrationServiceService ts = new AdministrationServiceServiceLocator("localhost", 8080, "/services/AdministrationService", false);
    AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService();

    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(new Integer(1));
    rsr.setFunction("DELETEVIEW");
    
	//Specify the view to be deleted by providing its ID or UUID
    rsr.setParameters(new String[] {
            "70103"
    });
    
    rs = rssbs.remoteAdministrationCall(rsr);

    if ("SUCCESS".equals(rs.getStatusCode())) {
        out.write("Success </br>");
    } else {
        out.write(rs.getStatusCode());
        out.write(rs.toString());
    }