AnsweredAssumed Answered

Why do I get different results from FieldNames function?

Question asked by eLaserBeth on Aug 25, 2017
Latest reply on Nov 9, 2017 by AaronSchacht

I am using a Set Variable script step to set a list of values using the FieldNames function and a subsequent Set Variable step to get the count of the aforementioned list of field names.  The curious thing that is happening is that on the first layout, the count of ALL the fields in the table is rendered, on the second layout, only a portion of the fields is counted. 


Layout #1:

- context = guests_trips_DATES

- the layout's TABLE has 219 fields total

- 39 of those 219 NATIVE* fields appear on the layout

   (*Native to the TABLE, not to be confused with fields from a related table)

- 105 fields in total appear on the layout (a combination of the 39 native + other fields from related tables)

- has the trigger to run the script OnRecordLoad


Layout #2:

- context = guests_TRIPS

- the layout's TABLE has 47 fields total

- 29 of those 47 NATIVE* fields appear on the layout

- 0 fields from related tables appear on the layout

  - has no script triggers set on the layout


When the OnRecordLoad script fires on Layout #1, the Set Variable step that renders a count of fields on layout #1 returns the value 219.  As expected.


A few steps later, a new window opens using Layout #2.

  - Set Variable script step sets the list of FieldNames followed by...

  - a Set Variable script step to get the count of field names from Layout #2


However, the result returned here is 29.  Not 47.


Furthermore, looking in the data viewer at ValueCount (FieldNames (Get (FileName); Get (LayoutTableName) )):

  - Any layout built on the context of DATES (whether guests_trips_DATES  or just DATES) shows a count of 219 fields.

  - A layout built on the context of TRIPS shows a count of 47 fields

  - in both/all cases above, the full field count is returned as a result of the expression, regardless of how many fields actually appear on the layout


It seems to be only this one TO (guests_TRIPS) that is presenting a subset instead of the full count.


I am hoping some FMGenius out there can shed some light upon it.


Thanks in advance.