Hi, how can I work with different tables in a template?
Example I have thes three tables, one with customers, other with relations between Customers and other with Sales:
Customers
document(pk)
name
lastname
dob
age
Relations
id_relation(pk)
document1(pk_Customers)
document2(pk_Customers)
tutor(Y/N)
Sales
id_sales(pk)
customer(pk_Customers)
Template grow from Sales table.
In the template i need to indicate โYESโ if the person is under 18 or โNOโ if the person is 18 years or older. And if customer is under 18 display the data of the Customer who have tutor attribute on YES(there will be only one with this condition).
I tryed with: <<IF:SELECT(Customers[age],[document]=[customer])<18>>โYESโ<<endif>>
and didnยดt work.
Alone SELECT(Customers[age],[document]=[customer])
display the age data correctly.
For the second step, if the result of condition was โYESโ show the Customers data who is tutor, iยดm lost.
Thaks comunity!
The IF condition is not in proper syntax. You need to wrap the SELECT() with an ANY() function like so:
<<IF:ANY(SELECT(Customers[age],[document]=[customer]))<18>>โYESโ<<endif>>
EDITED: Corrected so that endif would show. Thanks @Steve !!
I would recommend reviewing these articles for more details about working in tempaltes.
And this Support Search will provide several others that might be of interest:
https://www.appsheet.com/Support?q=templates&hPP=10&idx=help&p=0&is_v=1
Hi, it was easier, i wasn`t familiar with โdereferenceโ. Solution was:
On sales table:
<<IF: [customer].[age]<18>>YES<>
But, ยฟhow many dereferences can be nested?
Still working on the second step.
Thanks!
Nested dereferences were recently introduced. What limit is there? Iโm not certain and donโt recall it documented.
If by โnestedโ you mean โchainedโ (e.g., [a].[b].[c]
), I believe three is new limit, but it should be easy enough to test longer chains and find out.
User | Count |
---|---|
41 | |
29 | |
24 | |
24 | |
13 |