MrMarco
17th April 2002, 15:10
Hi,

I wonder if there is a way of referencing fields of a record using a "field number" variable, or perhaps by using the field name. e.g.

Assuming a Baan Table Field Layout as follows:

Field Fieldname
1 item
2 desc
3 rtyp

I would like to reference the "desc" field by specifying it's field number (2 in this case), or perhaps by using it's field name ("desc").

Is there such a feature in Baan IV/V?

Thanks

MrMarco

evesely
17th April 2002, 15:47
I assume there is a reason that you don't want to reference the field as tablename.fieldname . Can you give an example of what you are trying to do?

ulrich.fuchs
17th April 2002, 15:53
You can build and evaluate code at runtime with the 4GL function expr.compile. See the Tools help for this.

example:

long handle

extern string fieldname
extern domain tcitem myitem

fieldname = "tiitm001.item"
handle = expr.compile ("myitem:=" & fieldname)

| Variable myitem should now contain the current value of the
| field tiitm001.item

expr.free (handle)


Code like this is commonly used in building interface software, where the enduser should have some way to freely indicate which field of eg. an ASCII file goes into which field of a table.

Hope this helps,
Uli

MrMarco
18th April 2002, 10:29
Ulrich,

Your example is great! It's exactly what I am looking for.

Danke für Ihre Hilfe!