Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I like to use an if statement in a button "select in field" action.
So in the field i now have:
if (pctypeid='2',pnTable,pcTable)
So depending on the value of pctypeid, I like to do a select/search on the pnTable or the pcTable.
The "Search String" of the action is a value I entered in a variable.
Thanks in advance.
Hi,
It's very simple, this is the script:
Data:
LOAD * INLINE [
Name, Address
AAA, AA-AAA
BBB, BB-BBB
AAA, BB-BBB
BBB, AA-AAA
];
Code:
LOAD * INLINE [
Code
1
2
3
4
];
And the button as an action that has Select in Field
=If(Even(Code), 'Address', 'Name')
And Search String
='*' & vSearchFor & '*'
If values 2 or 4 are selected in Code, the button will search for values starting with the value stored in the variable vSearchFor in the field Address, otherwise, search the same string but in the field Name. Two considerations worth mentioning:
Hope that helps.
Miguel
Hi, Stormy,
of course you can use an if-.statement, it must begin with "=":
=if (pctypeid='2',pnTable,pcTable)
Greetings from Munich
Martina
EVACO GmbH
Hi,
Indeed, any time you see the [...] button at the side of a text dialog means that it allows expressions. Check the attached application.
Hope that helps.
Miguel
I have tried that, but does not seem to work.
This is how it now looks.
It just does not do a sub select.
I cannot open your example, as I am still using the personal edition. (My work is still in discusion to buy a developer version)
Hi,
It's very simple, this is the script:
Data:
LOAD * INLINE [
Name, Address
AAA, AA-AAA
BBB, BB-BBB
AAA, BB-BBB
BBB, AA-AAA
];
Code:
LOAD * INLINE [
Code
1
2
3
4
];
And the button as an action that has Select in Field
=If(Even(Code), 'Address', 'Name')
And Search String
='*' & vSearchFor & '*'
If values 2 or 4 are selected in Code, the button will search for values starting with the value stored in the variable vSearchFor in the field Address, otherwise, search the same string but in the field Name. Two considerations worth mentioning:
Hope that helps.
Miguel
Thanks, I had the table/field not in quotes.