Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] help on the Script object

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] help on the Script object
 Login/Join
 
Silver Member
posted
Hi all,

I would need some help on how to access the XDDOC in javascript using the Script Object. In one of the documents that I found, it said that the XDDOC can only be available when executed as an iFL.

What does it mean?

Can anyone provide me some examples that I can follow?

Thanks

Cokey

This message has been edited. Last edited by: Tamra,


iWay 5.5, 6.01
Windows
all output (Excel, HTML, PDF)
 
Posts: 45 | Registered: April 07, 2010Report This Post
Silver Member
posted Hide Post
never mind about the XDDOC. it is basically XDDocument. But is there a java documentation of the library?


iWay 5.5, 6.01
Windows
all output (Excel, HTML, PDF)
 
Posts: 45 | Registered: April 07, 2010Report This Post
Silver Member
posted Hide Post
I got the script object working by following an example in iIT user guide. But the javascript example is very limited.


iWay 5.5, 6.01
Windows
all output (Excel, HTML, PDF)
 
Posts: 45 | Registered: April 07, 2010Report This Post
Silver Member
posted Hide Post
What is your objective here? Which example have you been following?

XDDocument is iSM's internal document type.

-
Srii
 
Posts: 38 | Registered: April 13, 2012Report This Post
Silver Member
posted Hide Post
For those who are interested, here is what I wanted to do. There is a column in the database containing dynamic JSON objects. The object will contains pairs of keys and values. like {"city":"Red Deer, Count of ", "dueDate":"2010-10-10"}.

As you can see, this json object will fail if I pass it to the json2xml services as it is missing the root tag. The following is the script that wrote to convert the tag in json to xml and append it to the end of the DocOut.

--------------------------------------------------------------------------------
importPackage(com.ibi.edaqm);
importPackage(com.iwaysoftware.iwscript);

function execute(){


var transformResult = new XDDocument();

var transform = tools.getTransform("QueryResult_TF");

var status = transform.execute(ctx.getDocIn(), ctx.getDocOut());

var root = ctx.getDocOut().getRoot();

var json_elements = new XDNode("JSON_Elements");

var json_to_xml = ctx.getDocOut().getRoot().findByName("JSON_XML");

var json_string = json_to_xml.getValue().replace('",', '";');

var json_string_new = json_string.replace('"', '').replace('{','').replace('}','');

var json_Array = json_string_new.split(";");

var newNode = null;

//tools.info("json_Arry = " + json_Array);
//tools.info("json_Array length = " + json_Array.length);

for (var i = 0; i < json_Array.length; i++){

if ((i == 0) && (json_Array[i].length() == 0)){
//do nothing

}else{
//tools.info("json_Array object " + i);
//tools.info("json_Array object = " + json_Array[i]);

var tag_name = json_Array[i].substring(0,json_Array[i].indexOf(":"));
var tag_value = json_Array[i].substring(json_Array[i].indexOf(":") + 1, json_Array[i].length());

newNode = new XDNode(tag_name.trim());
newNode.setValue(tag_value);

json_elements.setLastChild(newNode);
}
}

root.setLastChild(json_elements);

//tools.info("Testing of QueryResult_TF");


//ctx.setDocOut(transformResult);

//tools.debug(ctx.getDocOut());

return status;

}


iWay 5.5, 6.01
Windows
all output (Excel, HTML, PDF)
 
Posts: 45 | Registered: April 07, 2010Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] help on the Script object

Copyright © 1996-2020 Information Builders