2 Replies Latest reply on Nov 1, 2011 8:07 AM by KevinJames

    ValueListItems() quit returning results



      ValueListItems() quit returning results


      FileMaker Pro


      11.0v4 (possibly earlier. hard to tell. this code hasn't been touched in a while)

      Operating system version

      Mac OS X Snow Leopard and Lion

      Description of the issue

      I am an intermediately capable FileMaker coder. I have a solution I created for an activity at work which recently broke in a critical part of a reporting process.

      Does anyone know if the function ValueListItems() was broken with the 11.0v4 update? It was working fine before that and I cannot think of anything that touched that part of the code.

      In places where possible, I prefer making code dynamic, rather than hard-coding items. One case in point is that as part of a report I build, I look at a value list and create temporary counting variables for each item in that value list. It's a bit slower, but the resulting code won't break if a value list is modified. So, borrowing some code from here and other forums, I created the following method for creating the counting variables, which I add to as I loop through records, looking for the occurrence of these items. Make sense? Has worked well over many months of use. Until now.

      In the code below, the second Set Var used to create a list of the items in that value list. Now, nothing is returned.

      Does anyone know of anything or heard of anything that changed or broke with this function?

      Thank you in advance for any help or suggestions.

      - Kevin

      #Create Vars from Value List "VL_Family_Role"
      Set Variable [ $VL1_Name; Value:"VL_Family_Role" ]
      Set Variable [ $VL1_Items; Value:ValueListItems(Individuals::gThisVersion;$VL1_Name) ]
      Set Variable [ $VL1_Item_Count; Value:ValueCount ( $VL1_Items ) ]
      #Loop thru current Value List and create all variables for that list
      Set Variable [ $Loop_Count; Value:0 ]
      Set Variable [ $Loop_Count; Value:$Loop_Count + 1 ]
      Exit Loop If [ $Loop_Count > $VL1_Item_Count ]
      Set Variable [ $varName; Value:Filter ( "$" & GetValue( $VL1_Items; $Loop_Count) ; "$AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" ) & "_Count" ]
      Set Variable [ $varValue; Value:0 ]
      Set Variable [ $whatever; Value:Let ( [ variableName = $varName ; variableValue = $varValue ; formula = "Let ( variableName = variableValue ; \"\" )" ] ; Evaluate ( Substitute ( formula ; [ "variableName" ; variableName ] ; [ "variableValue" ; Quote(variableValue) ] ) //close Substitute ) // close Evaluate ) //close Let ]
      If [ $Loop_Count = 1 ]
      Set Variable [ $VL1_ListOfVars; Value:$varName ]
      Set Variable [ $VL1_ListOfVars; Value:$VL1_ListOfVars & ¶ & $varName ]
      End If
      End Loop

      Steps to reproduce the problem

      Step thru code and watch variables

      Expected result

      A list of Value List items loaded into a defined variable

      Actual result

      Nothing is returned - the variable is never initialized (which means a null result)

      Exact text of any error message(s) that appear


      Configuration information




        • 1. Re: ValueListItems() quit returning results

          Most likely guess is that the text in Individuals::gThisVersion no longer matches the name of your file. This function returns a null result if either the file name or the value list name used does not exist.

          I'd use this function this way:

          Set Variable [ $VL1_Items; Value:ValueListItems( Get ( FileName ) ;$VL1_Name) ]

          • 2. Re: ValueListItems() quit returning results

            Thank you @PhilModJunk - that put me on the right track. 

            Indeed, the global filename is set from a configuration field, not from the filename itself. There were reasons I thought that was a good idea, which of course I am now questioning. 

            Thanks again for the clear help. It was fixed in an instant, after looking for a long time for the cause. 

            - Kevin