Forum Discussion

GerryMunroe's avatar
GerryMunroe
Qrew Trainee
11 months ago

Save Table Aliases and use in formulas?

Hi all,

Can I save the table alias in a field and then use that value in a formula?

Example is a field in the table that identifies another table where I will lookup a value.

This works, the table alias is _DBID_UTILITY_MATRIX

GetRecords("{query}", [_DBID_UTILITY_MATRIX])

This doesnt work

GetRecords("{query}", [Calc Table Name])

Where [Calc Table Name] is a text field with value = [_DBID_UTILITY_MATRIX]

Either [_DBID_UTILITY_MATRIX] or "_DBID_UTILITY_MATRIX"  Any ideas?

My fallback is to create a series of case statements with the alias hardcoded like this

Case([Calc Table Name],"table 1",GetRecords("{query}", [_table_1],

"table 2",GetRecords("{query}", [_table_2],

"table 2",GetRecords("{query}", [_table_2])

Gerry



------------------------------
Gerry Munroe
------------------------------

4 Replies

  • Hej Gerry!

    Question, why are you planning to use the table alias instead of the ID?

    Something like:

    GetRecords("{3.GT.0}", "bck7gp3q2")

    Back to the question, you might try saving the text string as '_DBID_UTILITY_MATRIX' and then call the field. However I've never seen the table alias used in the GetRecords function.

    Will give it a shot from my side and let you know if it works :)



    ------------------------------
    Lordsman Burgos
    ------------------------------
    • GerryMunroe's avatar
      GerryMunroe
      Qrew Trainee

      The table ID works great - Ill run with that.  Ive always used aliases before.

      Thanks so much!

      Gerry



      ------------------------------
      Gerry Munroe
      ------------------------------
  • Just tried it from my side and it seems like it works. I'm trying this formula:

    SumValues(GetRecords("{1211.TV.'"&[Adviser_2]&"'}AND{2723.LTE.1}AND{2716.EX.1}",[AliasTest2]), 2716)

    Where the AliasTest2 field, is a Formula - Text set to 

    [_DBID_DEVTEST]

    Let me know if you keep encountering issues, but from here, seems like your method should work OK!



    ------------------------------
    Lordsman Burgos
    ------------------------------
    • GerryMunroe's avatar
      GerryMunroe
      Qrew Trainee

      Thank you for that.  It works as you said, but not when entered as a text field which I had. Still dont think I can save the table name in a field, and then ref that in a formula text field to get it into the Getrecords statement. its not recognized.

      To be clear - try putting [_DBID_DEVTEST] in a user entry text field, then see if you can use that somehow.  I cant get it to be recognized! 

      Thanks so much for responding.

      Gerry 



      ------------------------------
      Gerry Munroe
      ------------------------------