Forum Discussion

frac's avatar
frac
Qrew Member
2 months ago
Solved

Syntax help using a variable in a formula query

Hello, i want to update my filter query to use a variable for the column number.

var text vRef = [ReferenceID];
var text QUERY = "{7.EX.'5'}";

vRef is my column number, what is the right way to replace the 7 in my query with vRef?

I've tried changing my ReferenceID column to both text and numeric, and have changed vRef to match, but neither seems to work. 

var number vRef = [ReferenceID];
var text QUERY = "{vRef.EX.'5'}";

 

  • frac's avatar
    frac
    2 months ago

    thanks for the replay,  its not the second part of the query that i want to swap, it was the numeric column field.  i did some digging and it looks like while i cant seed a variable for the column number into the beginning of the query, i can just make the entire query string a variable and fed that in.  so i made another column with a formula query that updates of the referencde, and then i am pulling that whole thing in instead. 

    var text vQuery = [Query];
    var text QUERY = $vQuery;

     

2 Replies

  • trry this

    Here is an example

    var text QUERY = "{7.EX.'" & [ReferenceID] & "'}"

    I always get tripped up by those single quotes.  I find that if the data in the field. [ReferenceID] was pure alphanumeric with no spaces or no unusual special characters that you don't need the single quotes, but they never hurt.

     

      

     

    • frac's avatar
      frac
      Qrew Member

      thanks for the replay,  its not the second part of the query that i want to swap, it was the numeric column field.  i did some digging and it looks like while i cant seed a variable for the column number into the beginning of the query, i can just make the entire query string a variable and fed that in.  so i made another column with a formula query that updates of the referencde, and then i am pulling that whole thing in instead. 

      var text vQuery = [Query];
      var text QUERY = $vQuery;