Options

File.Write and Record

fufikkfufikk Member Posts: 104
edited 2006-06-09 in Navision Financials
Hi,

I'm trying do write a record variable to textfile and then retrive data, field by field.
f.textmode(true);
f.create(...);
f.write(record);
f.close;

and the file is created, but the order of fields in this file is different from the order of fields in this table (by field no.).

I've noticed that flowfields are shifted to the end, but still regular fields are scrambled.

Does anyone know why or how this happens?

Comments

  • Options
    ara3nara3n Member Posts: 9,256
    That is how it is converted to text. I would use recordRef and fieldRef. Loop through the fields and write them to text. and when you read them you'll loop through the fieldref and read them back.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    fufikkfufikk Member Posts: 104
    Unfortunatelly, I'm using NF 2.6 and these variable types haven't been invented yet :)

    Anyway, I've noticed the way NF writes rec to file, the first fields come from the primary key, then comes the rest of "regular" fileds and finally the flowfields.

    This information makes it a whole lot easier, but is there a way to reach from C/AL list of PK fields in correct order?
    The Field table doesn't seem to have that info...
  • Options
    fufikkfufikk Member Posts: 104
    Oh, right before flowfields come flowfilter fields.
    So the record is dumped with fields in following order:
      - Primary key fields (in the order you see in keys in table designer) - Regular fields (ordered by fieldNo) - Flowfilter fields (ordered by fieldNo) - Flowfield fields (ordered by fieldNo)

    fields' values are separated by TAB. Flowfields need to be calculated before dumped.
  • Options
    KowaKowa Member Posts: 920
    fufikk wrote:
    Unfortunatelly, I'm using NF 2.6 and these variable types haven't been invented yet :)
    It is possible to do an executable upgrade to the current Client and Server Version . The 2.6 Database Objects will remain, but you can use the new features in C/AL for new developments.

    The order of the fields in a record can be checked in the C/AL Symbol Menu Form when the rec or record variable is selected in the left column.
    Kai Kowalewski
Sign In or Register to comment.