Accessing variable values in different record formats

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

Accessing variable values in different record formats

Post by Theju112 »

I have two record formats in a display file. When a button is clicked on the first record format, the control is passed to the RPG program by the below javascript code set in OnClick property:

Code: Select all

changeElementValue("CCS1ACTION","MAP");
pui.click('btnSubmit');
The CCS1ACTION field value ("MAP") shows up in the RPG program as required.

But what I am trying to do is to use the value of the CCS1ACTION field value in the OnLoad Javascript of the second record format. But as I found out, this value is not visible in the Onload javascript of the second record format.

I have put the below statement in the OnLoad script of the second format and I see the value Undefined.

Code: Select all

alert(CCS1ACTION.getElementValue);
What I want to access is the value set to CCS1ACTION from the first screen though the ChangeElementValue method.

Kindly provide your suggestions on how this can be achieved.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Accessing variable values in different record formats

Post by Scott Klement »

Your code is wrong, it should be:

Code: Select all

alert(getElementValue("CCS1ACTION"));
That assumes that CCS1ACTION is the "id" property of a widget that is on the current display.

You mention that there is more than one record format, but you did not mention how you are displaying them or what the id of the widget is. You can use the debugging tools in your browser to inspect the elements on the page to determine this.
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

Re: Accessing variable values in different record formats

Post by Theju112 »

Hi Scott,

I just figured this out by myself when the profound ui javascript prompter (auto-complete) showed the getElement method.

The tough thing about debugging in my case is that I am running an Android app on the bluestacks android emulator and I am not aware of any "debugging" tools in the emulator. Hence I am having to guess whats wrong if somethings not working as expected.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Accessing variable values in different record formats

Post by Scott Klement »

I'm not familiar with BlueStacks, but it usually makes sense to test a mobile app in Chrome first, then deploy it to mobile.

With an actual Android device, it's also possible to connect a USB cable to the Android device and connect it to a Chrome browser so that you can use Chrome's debugging tools to debug an application running on the device.
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

Re: Accessing variable values in different record formats

Post by Theju112 »

Thank you Scott. As I have learned, most emulators (including bluestacks) have an option to present themselves as a USB connected android device to Chrome. Hence these appear as remote devices in the chrome dev tools. So we dont really need a physical android device to test.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests