Hi I’m trying to access some fields in a tabel, but I’m only able to get the FieldID in a variable, and I can’t seem to find any function that is able to do some of the following : Record1.GETFIELDFROMNUMBER(nField) := Record2.GETFIELDFROMNUMBER(nField); If anyone know any way to do this, or if it’s possible to store the fieldnames and access the fields from these. Henrik Andresen
Sorry, there isn’t a way of getting at fields just by using the field number. You can use the virtual table “Field” to find out what type of field it is but getting to the data, no way. This has been a long standing deficiency in Navision. Cheers, John
Well bugger!! Better find another way to do it then… Thanks anyway. Henrik
You can use C/Front to retrieve fields by number, but the requires programming in another language. You could create a COM Object that uses C/Front to access the database and the you could call it from inside C/SIDE. It would be rather messy.
You can write the record to an external file:
file.TEXTMODE(TRUE); file.CREATE(tempfile); file.WRITE(recordvar); file.close
This will write the record to an external file with the fields separated by the TAB character. You can then use the “Field” virtual table to find the ordinal position of the field in the external file. At this point you can read the external file counting TAB’s until you get to the data for the required field. It’s a lot of trouble but should work.