No announcement yet.

Help! Multiple field lookup sql

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! Multiple field lookup sql

    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!

  • #2
    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.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      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.


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



        • #5
          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..