Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] help on the Script object
Go
New
Search
Notify
Tools
Reply
  
[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: 44 | Registered: April 07, 2010Reply With QuoteReport 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: 44 | Registered: April 07, 2010Reply With QuoteReport 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: 44 | Registered: April 07, 2010Reply With QuoteReport 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, 2012Reply With QuoteReport 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: 44 | Registered: April 07, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

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

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.