Page 1 of 1

[RPG]retreive all the table row value not only currentrows

Posted: Wed Oct 26, 2016 4:13 pm
by MegumiSawada
Hi

I believe we cannot retreive values from label or non-editable textbox because these are not editable.
If you set it to table ID, then you will be able to get it when its tapped.
However. the customer would like to get values from all the rows from the table, not only current row, to check.

[requirements]
There's a barcord element on the form as well as table element.
If the scanned barcode matchs any of table rows Column1, then the scanned value info will be added to that table row's other columns.
So column1 value of all the table row need to be retreived to check.

To acheive this, they use array to store column 1 values from all the table rows at the moment.
But is there any better way to do acheive their requirements?

Also, we would like to ask if it is technically possible to enhance LRNG_Getproperty to be able to retreive non-editable field values.

Best Regards,
Megumi Sawada

Re: [RPG]retreive all the table row value not only currentrows

Posted: Thu Oct 27, 2016 11:18 am
by tsupartono
Hi Megumi,

There are a couple of ways you can send the information back to the server:

1) Using hidden textboxes to store the value
You can store a copy of the column1 values in hidden textboxes - they would then get submitted back to the server.
So you would create an additional column (let's called it Hidden) in the table, and set it to be a textbox. When setting the text of column1's label for each row, you would also copy that value to the textbox in the Hidden column.

An example of the Hidden column definition in the DDS (assuming we are placing the hidden textboxes in the first column):

Code: Select all

Col%1.Name: HIDDEN
Col%1.Type: TextBox
Col%1.Content.Collapsed: Y
2) Using form variables to send the values back to the server
You can put the values you need to send back to the server in form variables.
For more details, have a look at the "Vars" property in the Form documentation:
http://www.longrangemobile.com/docs/lrp ... s/form.htm

Note that you will need to tell the form to send the variables back to the server (by setting the SubmitVars property to true):

Code: Select all

LRNG_AssignBoolToProp(*ON : '/Form.SubmitVars');
As for your enhancement request, unfortunately it would not be feasible to change LRNG_GetProperty so that it can read any properties. I think the use of form variables would be a good alternative in situations like these.

Re: [RPG]retreive all the table row value not only currentrows

Posted: Thu Oct 27, 2016 1:54 pm
by MegumiSawada
Hi Tony,

Thank you! I have some further questions regarding form variables.

How long form variables will be persist? Within the job? within the program?
Also, is there any way to clear all the values of form variable somehow?

Best Regard,
Megumi Sawada

Re: [RPG]retreive all the table row value not only currentrows

Posted: Thu Oct 27, 2016 3:27 pm
by tsupartono
The form variables are associated with the form instance - so it persists for as long as that form instance is alive.
A form instance remains the same when the "send-changes-only" flag is on (in RPG, this is set via invocation of LRNG_SetSendChangesOnly).
Because its lifetime is tied to the form's - it's ideal for handling situations such as yours (as the data needs to be there only for the duration of that form).

Note that the variable you set as a value can be contains sub-property.
In this example below, MyVar1 contains sub-properties SubValue1 and SubValue1.

Code: Select all

LRNG_Using('/Form.Vars');

LRNG_SetProperty('MyVar1.SubValue1' : 'One');
LRNG_SetProperty('MyVar1.SubValue2' : 'Two');

LRNG_EndUsing();
You can clear a form variable (including all its subproperties), by setting it to NULL.

Code: Select all

LRNG_AssignNullToProp('/Form.Vars.MyVar1');