M
Mohammed Siraj
Guest
Iram, EVAL blocks are used to compute and return String results into Templates/HTML Components. Yes, they can also be used to embed computed simpe types like Numbers/Strings (as strings) into code snippets of script components. However, you need to ensure that on evaluating the expression and substituting the value in code snippet the code syntax should still be valid. This is supported by the platform, however, designing it is a fairly complex task. One basic example is listed here: http://documentation.progress.com/output/rb/doc/index.html#page/rb/avoiding-mixing-client-side-and-server-side-apis.html Now, regarding selectQuery2 - server-side API. This returns a 2D array as result. hence, it needs to be processed into a JSON string and made available to your code snippet. Attached with this post is a sample application, with two script component examples. One that iterates over all the records of an object and prepares a string result for output. Second that iterates over all the records of an object and prepares a json string for output. In the second case, on client-side you can parse the json string back into an object. Note: Using EVAL blocks in client-side component eventhough is a faster way of embedding dynamic values for client-side processing, it is fairly complex because of syntax and evaluation constraints. The EVAL block will be evaluated on server-side and the resulting string expression will be substituted in the code snippet. User needs to ensure that on substitution, code snippet syntax is still valid. On the client-side, this code snippet will then be executed in browser environment. (Please visit the site to view this file)
Continue reading...
Continue reading...