Zum Hauptinhalt gehen

Can you programatically change the Where clause of a Query Layer activity?

Kommentare

2 Kommentare

  • Berend Veldkamp

    Sure, the where property would be something like this:

    =`field1='${ $form1.state.textBox1.value }' AND field2='${ $form1.state.textBox2.value }'`

    which results in

    field1='hello' AND field2='world'

     

    If one of the values contain single quotes, you will have to replace those with siongle quotes

     

     

    0
  • Chris Dunlop

    Thanks for the help Berend. My case is slightly different, as the user can only select from one dropdown (the others are reset as soon as a value is picked). However, I was able to solve it as follows:

     

    • Added a Create Value activity called valueWhereClause to hold the value of the Where clause
    • added a series of IF activities to figure out which dropdown was populated
    • after each IF activity, used an Evaluate Expression to set the value of the valueWhereClause based on the appropriate attribute
    • Each If statement then points to a common Query Layer activity. Its Where clause is set to =$valueWhereClause.result

     

    Other than the inelegance of multiple IF activities, it does everything using a single Query Layer activity, so I'm happy.

     

    Thanks for your help. It gave me some ideas.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.