Help! Multiple field lookup sql

Hi,
Is it possible to have 2 lookup sql on one select field?
For example, I have a radio button with 2 options.
If radio1 is selected, the select field lookup is “select * from table_a a where a.field_1 = {field1}”
If radio2 is selected, the select field lookup is “select * from table_b”

I put the query on each radio option value, and use ajax processing. It didn’t work.
Is it possible? Can anyone tell me how?

Thanks a lot!

Yes you can. You have to use global vars. In the ajax event at the radio button you set a global variable containing the required where clause. Then do a exit(ref) to reload the same application. Due to the global variable the select will contain the required arguments.

Thanks! I’ll try it out.
I ended up using more fields with show and hide option on radio click. It’s too complicated and there’s still bug.
I’ll try your method for hopefully cleaner result.

AVOID GLOBAL VARIABLES! bad practice especially when you have several fields that need to update this is a nightmare to deal with

Arthur

You can use global vars as long as you are aware enough to take vars with unique names. E.g. glob_personname etc…
Just be aware of them and it should all work fine…