Reputation:
I'm currently migrating a Lotus Notes application to XPages. The application contains several formulas which use "@Transform" and as there is no SSJS equivalent for "@Transform", I'm wondering how best to code these formulas in XPages. At the moment I'm trying using session.evaluate. Is this the best option or is there another method which someone could recommend?
Upvotes: 0
Views: 718
Reputation: 2932
session.evaluate
is handy if you have existing @Formula code. In SSJS you can use:
for (var i in array_variable) {
print(array_variable[i]);
}
or
for (var element in vector_or_list) {
print(element);
}
Upvotes: 3
Reputation: 2807
I would suggest using session.evaluate() as you are trying to do currently.
Since you write "trying" - do you have any issues with this? If you use this functionality in several places I would recommend creating a custom Java class to handle the evaluate (and ensure proper input). It can easily be called from your SSJS - and it would make a fine candidate for an XSnippet or an extension to the Extension Library ;-)
/John
Upvotes: 0