2 Replies Latest reply on Jul 5, 2013 7:30 AM by BenGraham

    Count ( $fieldName )  = ? ( The specified field cannot be found. )

    BenGraham

      I must be missing something. How can I use indirection with the Count ( ) function?

       

      In the Data Viewer I have tested various expressions to figure out what is going on:

       

       

      Let (

      x = GetFieldName ( syn_inv_MEDIA::id ) ;

       

       

      //Count ( x ) // = ? with message "The specified field cannot be found." ( this is the problem )

       

       

      //GetField ( x ) // = 12063508651157000000006642000166351230610

       

       

      // GetFieldName ( Evaluate ( x ) ) // = syn_inv_MEDIA::id

       

      // x = "syn_inv_MEDIA::id" // = TRUE

       

      x = GetFieldName ( syn_inv_MEDIA::id ) // = TRUE

       

       

      )

       

       

      What is hard to understand is that GetField ( x ) works as it should, but Count ( x ) does not. And that x = "syn_inv_MEDIA" is also true does not make sense.

       

      FileMaker function reference for Count () says this about the Parameters :

       

      field - any related field, repeating field, or set of non-repeating fields; or an expression that returns a field, repeating field, or set of non-repeating fields.

       

      So is there anyone that is seeing what I am not and knows how to use indirection for a field in the Count () function?

       

      My script knows the field that needs to be counted with the variable set, but each time the script loops through the next table the field table name will change. I will always be counting fieldname "id", the table will be different on each loop.

       

      Any help is very much appreciated.

       

      Cheers,

      Ben