How to get the current field?

ufukufuk Member Posts: 514
Hi,

I am trying to log the modifications in Item table and our license does not include Change Log Management. I have checked Change Log Management but I could not exactly understand the way to get the current field and begin a loop between fields. :D

Is there a simple way to get the current field no.?

Regards.

Ufuk
Ufuk Asci
Pargesoft

Comments

  • gulamdastagirgulamdastagir Member Posts: 411
    plz use FIELDREF data type FieldRef.NAME or FieldRef.Number
    Regards,

    GD
  • David_SingletonDavid_Singleton Member Posts: 5,479
    ufuk wrote:
    Hi,

    I am trying to log the modifications in Item table and our license does not include Change Log Management. I have checked Change Log Management but I could not exactly understand the way to get the current field and begin a loop between fields. :D

    Is there a simple way to get the current field no.?

    Regards.

    Ufuk

    First you need to purchase the granule. :mrgreen:
    David Singleton
  • ufukufuk Member Posts: 514
    plz use FIELDREF data type FieldRef.NAME or FieldRef.Number

    Can you give an example? When I tried using fieldref datatype, it gives an error as it could not be initialized.
    Ufuk Asci
    Pargesoft
  • gulamdastagirgulamdastagir Member Posts: 411
    you have to initialize fieldref from recordref.FIELD function
    rf.OPEN(DATABASE::item);
    message('The %1 table contains %2 records',
    rf.CAPTION, rf.COUNTAPPROX);
    
    
    fr := rf.FIELD(3);
    message('The %1 field has %2 length',
    fr.NAME, fr.LENGTH);
    
    Regards,

    GD
  • diptish.naskardiptish.naskar Member Posts: 360
    Use the FieldNo and FieldName to perform the same. for example

    ItemHistRec."Field ID":=FIELDNO("New Name"); This will give you the fieldno. now use the field name to get the name, and you can create the history of the modifications that you make in the item table.
    Diptish Naskar
    For any queries you can also visit my blog site: http://msnavarena.blogspot.com/
  • ufukufuk Member Posts: 514
    ItemHistRec."Field ID":=FIELDNO("New Name"); This will give you the fieldno. now use the field name to get the name, and you can create the history of the modifications that you make in the item table.

    Thanks, but in this case you have to manually give the field name. I can use FIELDNAME instead of FIELDNO when using the field name as parameter (this is what I am now temporarily using):D

    But I want something like this: On the Modify trigger of the item table, get the fieldno modified (without using a parameter like name etc.), find it in the fields table and insert the modification description and the above field name in my change log entry.
    Ufuk Asci
    Pargesoft
  • ufukufuk Member Posts: 514
    rf.OPEN(DATABASE::item);
    message('The %1 table contains %2 records',
    rf.CAPTION, rf.COUNTAPPROX);


    fr := rf.FIELD(3);
    message('The %1 field has %2 length',
    fr.NAME, fr.LENGTH);

    Thanks gulamdastagir. This works fine :)
    Ufuk Asci
    Pargesoft
Sign In or Register to comment.