I am unable to invoke the query from server side, while retr

Posted by nikhil.nehra on 24-Jul-2014 04:55

I am facing an issue, while retrieving the object for an html tab. I am unable to invoke the query from server side. Also tell me whether I am going in right direction OR not.

Code snippet:

<html><h2>
Catalogue: #EVAL[ rbv_api.selectQuery( ("SELECT catalogue_name FROM catalogue1 where R105230466=?", 100, {!R105230466})]
</h2></html>

Error snippet:

<html><h2>
Total Catalogue: ERROR: Syntax Error (line #4) in formula: var rbv_api = new Packages.com.rb.core.services.api.ServerSideAPI(104579663, 104581299); rbv_api.setParamsType(0); rbv_api.selectQuery( ("SELECT catalogue_name FROM catalogue1 where R105230466=?", 100, )
</h2></html>

All Replies

Posted by Mani Kumar on 24-Jul-2014 05:07

Hi Nikhil,

I understand from your comments that you are trying to use rbv_api in HTML page, Is that correct?

As rbv_api lives on Rollbase server and you will not be able to use the same in HTML pages.

Use Page Editor and add Script Component to your page. In that component you can use server-side APIs.

Regards,

Mani.

Posted by nikhil.nehra on 24-Jul-2014 05:28

Actually I want to create a small application, an html page having Menu items then Sub-Menu items then further categories. Then I will have to populate some previously created Items/data (Objects) from Rollbase database to my html page. Please tell me the right way to start all this. Currently I want to fetch Object's data on my html page but there is only one option available on page editor, which is "Browser-Side API".....How can I use Server-Side API from here...is it possible?

Posted by Mani Kumar on 24-Jul-2014 06:13

Hi Nikhil,

As you have mentioned, you will be able to access the server side objects using the Client-Side API's

There are set of Client-Side API's that will help you to perform these actions. I would suggest you to refer the below documentation url related to these API's:

documentation.progress.com/.../index.html

For the API that runs as SQL SELECT query on the server, you can use rbf_selectQuery(). This function runs a SQL SELECT query on the server and returns results to a callback function.

Syntax

rbf_selectQuery(query, maxRows, callback)

Example

The following example reads two fields from record defined by template token {!id}:

function my_callback(values) {

var amount = values[0][0];

var price = values[0][1];

// Do something...

}

rbf_selectQuery("select amount, price from order where id={!id}", 1, my_callback);


Hope this helps.

Regards,

Mani.

 

Posted by nikhil.nehra on 24-Jul-2014 06:25

Thanks Mani for your help. I will do the same and will ask you for help if stuck some where....Thanks again for your help !!

This thread is closed