How to get the list of just the VISIBLE Field names from a layout in Table View?

Hi,
We have the function FiledNames( "" ; Get ( LayoutName ) ) that will output the field names of the current Layout, however, it will even include the masked field of a table view.

I'd like to get just the filed names of the visible fields (even if they are not editable) in browse mode

Any idea ?

Thanks

1 Like

I think this requires a bit of extra work: I would try to wrap the hide conditions with a let statement and put $$HIDDEN.FIELDS = $$HIDDEN.FIELDS & ¶ & GetFieldname in it.

This list you could compare with the result of the FieldNames function. But I haven't tried this yet.

1 Like

Thank but I need something universal, that work on all layouts without modifications

OK – after reading your post again I realized that you mean table view.

When I do a calculation FieldNames ( "" ; Get ( LayoutName ) ) being in a dedicated table view layout, I get only the names of the fields shown in the table.

But once I have added the other fields in form view - even if I hide them again in table view - there seams to be no obvious way to get only the names of the displayed fields.

So I think you can do this only in a dedicated table view layout.

Found out a solution leveraging save record as xlsx

This script returns the names of just the fields that are actually visible by the user on the layout, even in table view
this uses the awesome baseelment plugin

Set Variable [ $fp ; Value: Get ( TemporaryPath )&"exl.xlsx" ] 
Save Records as Excel [ Restore ; With dialog: Off ; “$fp” ; Current record ; Create folders: Off ] 
Set Variable [ $x ; Value: BE_Unzip ( "/Volumes" & $fp ) ] 
Set Variable [ $sharedStrings ; Value: BE_FileReadText (  "/Volumes"&Get ( TemporaryPath )&"/xl/sharedStrings.xml" ) ] 
Set Variable [ $workbook ; Value: BE_FileReadText (  "/Volumes"&Get ( TemporaryPath )&"/xl/worksheets/sheet1.xml" ) ] 

Set Variable [ $last_column_index ; Value: BE_XPath( $workbook ; "/xmlns:worksheet/xmlns:sheetData/xmlns:row[1]/xmlns:c[last()]/xmlns:v";"xmlns=http://schemas.openxmlformats.org/spreadsheetml/2006/main";1 ) ] 
Set Variable [ $cells ; Value: BE_XPathAll( $sharedStrings ; "/xmlns:sst/xmlns:si/xmlns:t";"xmlns=http://schemas.openxmlformats.org/spreadsheetml/2006/main" ) ] 

Set Variable [ $fieldnames ; Value: LeftValues($cells;$last_column_index+1) ] 

Exit Script [ Text Result: $fieldnames ]
6 Likes

Very clever, @Vincent_L

If you need it as a function, I think you can also use getLayoutObjectAttribute ( objectName ; "attribute" ) this will let you loop through your list of object names and check if each is editable. you can even check if it's currently hidden by a hide condition etc. Just in case you wanted something in a function.

Thanks but I wanted something that works universally, without any extra requirements, such as object names. The excele thing did it