How to obtain the values of fields in the record producer, from a client script of a variable set?

EvilRojo
Tera Expert

Hello, I want to know how to obtain the field values in the record producer, from a client script of a variable set that is located within the same record producer, i need an example

 

 

//Client script from variable set

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var mon= g_form.getValue('u_variable_from_variable set');
    var macom = producer.u_variable_from_Record_producer; //doesn't work
    var total = 0;
    total = total + mon;
    g_form.setValue('u_results', macom - total);
}

 

3 REPLIES 3

Gus1
Tera Expert

You should just be able to call producer.variable_name in the script of the record producer. You could set a field like current.u_requested_by = producer.requester
requester is the variable in the variable set we're using. Hope that helps. 
Edit: I guess I didn't quite read the question right, you're trying to pull the value from a client script within a variable set that is located within the same record producer. where exactly are you storing the client script value? what is your client script doing exactly?

 

EvilRojo
Tera Expert

I want to get the value of a field in the record producer from my client script from my variable set to use the field and then return a value to a field in the record producer in a client script type on change

The same way you would get/set the value of a variable directly on a Record Producer:

g_form.getValue("variable_name");

and then:

g_form.setValue("other_variable", calculatedValue);