Forum Discussion

PrakashMurali's avatar
PrakashMurali
Qrew Member
5 months ago

Variable Declaration Error

Hi,

I have two tables named [Startup] and [Fund]. There is no relationship with the tables. I want to fetch the allotted fund value based on the financial year of the startup from the startup table. I created a query to fetch the fund value based on the financial year, but it throws an error saying undeclared identifier.

This is the formula

var text FY = [Financial Year];

If ($FY!=null,
    (GetFieldValues(GetRecords("{6.EX.'$FY'}", [_DBID_TANSIM_FUND]),8)),null)


------------------------------
Prakash Murali
------------------------------

6 Replies

  • I'm not 100% sure what the formula errors specifically are alluding to - but from reviewing your formula they syntax in general looks off. I would suggest trying the following and seeing if it responds differently: 

    var text FY = [Financial Year];

    If ($FY != "",
        (GetFieldValues(GetRecords("{6.EX.'" & $FY & "'}", [_DBID_TANSIM_FUND]),8)),
    null)
    The 2 changes are: 
    1. Change $FY != null to "", since FY is text you need to compare it to blank text
    2. In your query - you have the $FY inside of the '' as if that was the value. Break out the variable from the string by doing '" & $FY & "'
    You might also have to do a ToNumber or ToText function around the query as the response from queries is a multi select value that you likely need to convert.  


    ------------------------------
    Chayce Duncan
    ------------------------------
    • PrakashMurali's avatar
      PrakashMurali
      Qrew Member

      Hi Chayce,

      Thanks for responding. I have tried your code. Still, it throws the same error. I have attached an image for your reference. Please advise on this.



      ------------------------------
      Prakash Murali
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Are you getting an actual error in your formula anywhere that is leading you to check the formula? That formula checker is a new feature as of this month - and it appears like some kind of a bug when processing variables. I checked it in my environment for a formula that I know 100% works as intended and it is reporting the same issue with the variable that you are seeing. 

        My assumption is that the error you're seeing in the formula checker is a bug with the feature, not your formula. I would advise saving the formula and seeing if you're getting the intended result in your records and ignoring the formula checker for now. 

        If you're having issues and just want the error gone - I would gues you'll need to remove the variable declaration like so: 

        If ([Financial Year] != "",
            (GetFieldValues(GetRecords("{6.EX.'" & [Financial Year] & "'}", [_DBID_TANSIM_FUND]),8)),
        null)


        ------------------------------
        Chayce Duncan
        ------------------------------