This article contains several Graphit file examples. Graphit file names, when are mentioned, refer to the files that can be found in the KB Demo Project under Project Tree > Web Services
The following Graphit file gets an input LUI, which extracts customer data from the CUSTOMER LU, using GET and SQL commands.
The following Graphit file gets an input LUI, which extracts customer data from the CUSTOMER LU, calculates its balance and sets its status accordingly.
Output data is returned with further information on whether the customer is either a:
This example displays how to retrieve data from multiple tables in the BILLING_DB database and use Graphit to prepare a CSV-formatted response:
Run the Graphit file in a Debug mode with 2 and 3 as consecutive values for the SubscriberID:
Notes:
The csvRow has been set to the SUBSCRIBER_ID node. Therefore, a new line has been created for each new subscriber_id entry.
The csvHeader has been set to False in the SUBSCRIBER_INFO node. Therefore, the header has been removed from the CSV output.
This example illustrates an XML output in raw format. Observe the header value displayed in the response.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><SUBSCRIBERS><CRM_DB><SUBSCRIBER_ID>97</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>98</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>99</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>100</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>101</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>102</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>103</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>104</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>105</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>106</SUBSCRIBER_ID></CRM_DB></SUBSCRIBERS>
When removing the 'raw' from the node's type, the output will be as following:
<Root><SUBSCRIBERS><CRM_DB><SUBSCRIBER_ID>97</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>98</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>99</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>100</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>101</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>102</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>103</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>104</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>105</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>106</SUBSCRIBER_ID></CRM_DB></SUBSCRIBERS></Root>
This example illustrates a simple JavaScript routine that returns the highest number of the x random number and the y random number.
Output:
This example illustrates how 2 values, retrieved from a previously-defined SQL query, are concatenated.
Output:
The condition defined in this file triggers either the TRUE or the FALSE node, depending on the randomly generated values of x and y.
Output:
The x string has been added to both TRUE and FALSE groups, while the y value is not declared in the groups. The display ${x} also lists the group of origin.
Output:
This example shows how both Subscriber and Billing datasets are collected into one single array.
Output:
The sessionProvider flag is set to CRM_DB in order to enable direct references to CRM_DB tables and fields.
Output:
The response returns empty as the entire CRM_DB node and its children nodes are affected by the enabled flag.
Additionally, the nice flag is set to TRUE on the root node level. As a result, each tag of the response is indented according to the position of the tag in the document's hierarchy.
Output:
The one flag is set to TRUE and is applied to the Billing_DB2 node. The response brings only the first value for {"BILLING_DB2":{"SUBSCRIBER_ID":2}} instead of the 10 values expected for this tag, had the one flag not been activated.
Output:
The entry flag has been set to the Subscribers node and therefore the XML response displays tags around each subscriber_id value.
Output:
The attribute flag has been activated on all children nodes of the CRM_DB node.
Output:
The format flag has been set to XML in the CRM_DB node. If the format is specified, the node will only be evaluated and added if the output format matches the format value.
The example below requests JSON in the output format. The CRM_DB node, with all its sub nodes, is not displayed in the response as its format is in XML.
The showempty flag has been set to False and is applied to the CRM_DB node. Empty nodes are not shown in the response.
Output:
The showNull flag has been set to False and is applied to the CRM_DB node. The response does not display the LAST_NAM field in the CRM_DB node as it has Null values that are ignored and are not shown in the section of the response referring to the CRM_DB. The flag is not applied to the BILLING_DB node, and therefore Null values are displayed.
Output:
The numberFormat flag has been set to 000.00 and is applied to the NumberFormat node. All responses display numberFormat with 3 digits before the floating point and another 2 after it.
Output:
The response has been reorganized using the subscriber_id as a key.
Output:
This article contains several Graphit file examples. Graphit file names, when are mentioned, refer to the files that can be found in the KB Demo Project under Project Tree > Web Services
The following Graphit file gets an input LUI, which extracts customer data from the CUSTOMER LU, using GET and SQL commands.
The following Graphit file gets an input LUI, which extracts customer data from the CUSTOMER LU, calculates its balance and sets its status accordingly.
Output data is returned with further information on whether the customer is either a:
This example displays how to retrieve data from multiple tables in the BILLING_DB database and use Graphit to prepare a CSV-formatted response:
Run the Graphit file in a Debug mode with 2 and 3 as consecutive values for the SubscriberID:
Notes:
The csvRow has been set to the SUBSCRIBER_ID node. Therefore, a new line has been created for each new subscriber_id entry.
The csvHeader has been set to False in the SUBSCRIBER_INFO node. Therefore, the header has been removed from the CSV output.
This example illustrates an XML output in raw format. Observe the header value displayed in the response.
Output:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><SUBSCRIBERS><CRM_DB><SUBSCRIBER_ID>97</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>98</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>99</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>100</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>101</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>102</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>103</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>104</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>105</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>106</SUBSCRIBER_ID></CRM_DB></SUBSCRIBERS>
When removing the 'raw' from the node's type, the output will be as following:
<Root><SUBSCRIBERS><CRM_DB><SUBSCRIBER_ID>97</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>98</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>99</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>100</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>101</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>102</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>103</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>104</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>105</SUBSCRIBER_ID></CRM_DB><CRM_DB><SUBSCRIBER_ID>106</SUBSCRIBER_ID></CRM_DB></SUBSCRIBERS></Root>
This example illustrates a simple JavaScript routine that returns the highest number of the x random number and the y random number.
Output:
This example illustrates how 2 values, retrieved from a previously-defined SQL query, are concatenated.
Output:
The condition defined in this file triggers either the TRUE or the FALSE node, depending on the randomly generated values of x and y.
Output:
The x string has been added to both TRUE and FALSE groups, while the y value is not declared in the groups. The display ${x} also lists the group of origin.
Output:
This example shows how both Subscriber and Billing datasets are collected into one single array.
Output:
The sessionProvider flag is set to CRM_DB in order to enable direct references to CRM_DB tables and fields.
Output:
The response returns empty as the entire CRM_DB node and its children nodes are affected by the enabled flag.
Additionally, the nice flag is set to TRUE on the root node level. As a result, each tag of the response is indented according to the position of the tag in the document's hierarchy.
Output:
The one flag is set to TRUE and is applied to the Billing_DB2 node. The response brings only the first value for {"BILLING_DB2":{"SUBSCRIBER_ID":2}} instead of the 10 values expected for this tag, had the one flag not been activated.
Output:
The entry flag has been set to the Subscribers node and therefore the XML response displays tags around each subscriber_id value.
Output:
The attribute flag has been activated on all children nodes of the CRM_DB node.
Output:
The format flag has been set to XML in the CRM_DB node. If the format is specified, the node will only be evaluated and added if the output format matches the format value.
The example below requests JSON in the output format. The CRM_DB node, with all its sub nodes, is not displayed in the response as its format is in XML.
The showempty flag has been set to False and is applied to the CRM_DB node. Empty nodes are not shown in the response.
Output:
The showNull flag has been set to False and is applied to the CRM_DB node. The response does not display the LAST_NAM field in the CRM_DB node as it has Null values that are ignored and are not shown in the section of the response referring to the CRM_DB. The flag is not applied to the BILLING_DB node, and therefore Null values are displayed.
Output:
The numberFormat flag has been set to 000.00 and is applied to the NumberFormat node. All responses display numberFormat with 3 digits before the floating point and another 2 after it.
Output:
The response has been reorganized using the subscriber_id as a key.
Output: