I've imported a file from excel, a bad one. I Have 100 column with dates named date1, date2, date3,....
The target is to set all this dates in a multi field. To make it easy I would like to get in every field by the name of the field and set the text (date in the field) in a variable.
I can't find a way to get the field by name. I tried with SQL.GetFieldAsText but it looks complicate and i'm not secure it's the right way.
Do you have any suggestion?
Tankyou
I can't say that I have completely followed/understood your post.
But, it makes me think that perhaps one or more of the following could be of some help:
-
The GetField function
-
The GetFieldName function
-
The Set Field by Name script step
I'm a bit unclear too, but a first step might be to query all the fields in a given table via ExecuteSQL. You can even narrow this query to find only date/timestamp/time fields etc if you wish, and skip calculated fields (all up to you).
ExecuteSQL ( "SELECT fieldname from filemaker_fields WHERE tablename = ?" ; "" ; "" ; Get ( LayoutTableName ) )
And then, for example, if you want to get all the values for the current record into a single value you could write something like this:
While ([
~fields = ExecuteSQL ( "SELECT fieldname from filemaker_fields WHERE tablename = ?" ; "" ; "" ; Get ( LayoutTableName ) ) ;
~count = ValueCount ( ~fields ) ;
~res = "" ;
~i = 0
];
~i < ~count ;
[
~i = ~i + 1 ;
~field = GetValue ( ~fields ; ~i ) ;
~val = GetField ( ~field ) ;
~res = List ( ~res ; ~field & ": " & ~val )
] ;
~res
)
/*
date1: 1/2/2024
date2: 2/3/2024
date3: 3/4/2024
...
*/
Getfield!!!!!!!!!!!!!!!
you understood well! Thank You.
I'm using the italian version and sometimes it's hard to find what i Need.
I'm sorry for the stupid question . Thank u so much for the patience and the support.
Have a nice weekend
Massimo
Not a stupid question in the least.
I am certain that I speak for more than just myself when I say that I am glad that you asked.