Hi,
in layout/header/footer settings of a grid/form it’s possible to show a field value of the current table. How can I show a field value from a foreign table?
Joe
Hi,
in layout/header/footer settings of a grid/form it’s possible to show a field value of the current table. How can I show a field value from a foreign table?
Joe
Use a global variable in onappini asign the value for your table
Hi alvagar,
thanks for your help. I’d like to show customers name in header which is in a different table ‘customers’ in field ‘last_name’
Could you give me a code example?
Thanks
Joe
In Event ONSCRIPTINI:
sc_lookup(rs, “SELECT last_name FROM customers where id = {your_id}”);
[v_last_name] = {rs[0][0]};
Then This variable [v_last_name] put in your header/footer
Hi alvagar,
I tried
sc_lookup(rs, “SELECT last_name FROM customers where id = {customer_id}”);
[v_last_name] = {rs[0][0]};
and put [v_last_name] in the header but it shows for every customer only the number “1”
Whats wrong?
Joe
First test if your sql is Good in SQL Administrator. If ID is Character, It must be in ‘{customer_id}’.
Thank you I got it now. Just forgot to update variable settings in the grid.
Joe
One more question.
How would be the syntax if I want to show more than only one field? Do I have to define a global variable for each field?
Does someone have a code snippet?
Joe
[QUOTE=Joe;35132]One more question.
How would be the syntax if I want to show more than only one field? Do I have to define a global variable for each field?
Does someone have a code snippet?
Joe[/QUOTE]
Or concat, as you prefer.
sc_lookup(rs, "SELECT CONCAT (last_name, ' ', first_name) FROM customers where id = {customer_id}");
or
sc_lookup(rs, "SELECT last_name, first_name FROM customers where id = {customer_id}");
[v_last_name] = {rs[0][0]} . ' ' . {rs[0][1]} ;