select value

Posted by Abir ben salem on 09-Jun-2016 04:08

hi ,

how can I get a value related to the  record of object A  and display it while I select the record from a picklist in object B. please? 

it doesnt work : 

var x =rbv_api.selectValue("SELECT [value] FROM [object A] WHERE '{!R38716#name}'=?",'{!R38716#text}' );
return x ;

All Replies

Posted by satyanarayana sunku on 10-Jun-2016 02:26

Hi Abir,

I am able to get related related record values with below code at server side.

var arr=rbv_api.getRelatedIds('R10748', {!id});

for (var k=0; k<arr.length; k++) {

    var id = arr[k];

    rbv_api.println("id="+id);

 var x=rbv_api.selectValue("SELECT [value] FROM [object A]where {!R10748}=?",id);

    rbv_api.print(x);

}

and  can you please elaborate your use case and where you want to get related record values

Posted by Chandrasekhar Gontla on 10-Jun-2016 04:24

Hi Abir,

If I understand it correctly, you want to get related record field values when you selected a related record from lookup field in either new record or edit record page.

If that is the case, you could try client side APIs to achieve that.

> Please add the below script to either new or edit record page

<script>

 function getRelatedValues(){

   var valLookup = rbf_getFieldValue("R63695739");

 rbf_selectQuery("SELECT name FROM TaskMany WHERE id="+valLookup, 1, callback1);

}

function callback1(arr){

 alert(arr[0][0]);

}

</script>

> Add the function call to getRelatedValues() to 'OnChange' event of lookup field

Note: You will find that in Object Definition -> Fields -> Lookup field -> Events page

> Now, whenever you select record from lookup field, an alert will be shown in which it displays record name of the related record.

Please correct me if I am wrong

Thanks and Regards,

Chandu.

Posted by Abir ben salem on 10-Jun-2016 05:26

for my case , I need to get records in the object B , in a picklist  then get the amount associeted to this record.

  

Posted by satyanarayana sunku on 10-Jun-2016 07:59

Hi,

you can use the code given by chandu and replace alert with rbf_setFieldValue API to set the value for amount . To achive this you can try Client Side API's.

Please go through the below documentation for all available client side API's

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

Thanks

Satya

Posted by Abir ben salem on 14-Jun-2016 04:03

hi

this code doesn't  work for my case :

<script>

function getRelatedValues(){

var valLookup = rbf_getFieldValue("R38716");

rbf_selectQuery("SELECT {!R38716.amout#value} FROM school_year WHERE id="+valLookup, 1, callback1);

}

function callback1(arr){

rbf_setFieldValue(amount, value);

}

</script>

Posted by Mohammed Siraj on 14-Jun-2016 04:12

Abir, in the select query you should be using field integration name for amount field in school_year. That is,

<script>

function getRelatedValues(){

var valLookup = rbf_getFieldValue("R38716");

rbf_selectQuery("SELECT amout FROM school_year WHERE id="+valLookup, 1, callback1);

}

function callback1(arr){

rbf_setFieldValue(amount, arr[0][0]);

}

</script>

This thread is closed