RecordRef validated value

bulentherdembulentherdem Member Posts: 5
I use a recordRef variable for a function in codeunit and I call this function from onvalidate event. But after form runs and I change the value for a field, in codeunit fieldref.value doesn't be the updated value.

What will I do? what's the proper method to refresh the recordref data in codeunit... ] (*,)

Comments

  • krikikriki Member, Moderator Posts: 9,118
    I didn't understand completely the problem, but I think you should refresh your recordreference (and maybe also your fieldreference) after you changed the value in the form. Your recordreference probably still has the old record-version.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    after that, try to use
      yourRecordRef := yourFieldRef.Record;
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • bulentherdembulentherdem Member Posts: 5
    Dear friends, my problem is :

    After defining a recordref, writing the code is as below:
    RecordRef.OPEN(anyTable);

    FieldRef := RecordRef.FIELD(anyField);

    IF RecordRef.FIND('-') THEN REPEAT

    MESSAGE(FieldRef.VALUE);

    UNTIL (RecordRef.NEXT = 0)
    Firstly we run the code. For example we have 3 records.
    For 'anyField' field values : '1', '2', '3'. respectively '1','2','3' message will be displayed.

    Then I change the 'anyField' value from '2' to '99'.

    When I recall above code, while expecting '1','99','3' to display, I see '1','2','3'.

    I think this is related with transection. require to refresh data.

    Is there a way to see the updated value??

    (By the way, I'm new in navision. ) :)
  • kinekine Member Posts: 12,562
    And where are you calling MODIFY for the RecordRef, after you change the field??? ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • bulentherdembulentherdem Member Posts: 5
    dear kine,

    just before RecordRef.OPEN(anyTable);
    ==> RecordRef.MODIFY;
    RecordRef.OPEN(anyTable);

    FieldRef := RecordRef.FIELD(anyField);

    IF RecordRef.FIND('-') THEN REPEAT

    MESSAGE(FieldRef.VALUE);

    UNTIL (RecordRef.NEXT = 0)
  • krikikriki Member, Moderator Posts: 9,118
    Can you post the complete code?
    Probably there is something not in the correct place (or not all in the code)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bulentherdembulentherdem Member Posts: 5
    Well, actually I need to find out whether it is possible to refresh 'recordref' or 'fieldref.VALUE'.

    After Refreshing the recordref that related table, It will be possible to see the changed data.

    I call MODIFY (updating a record) from another any form object.

    Dear friends, If you think this is confusing, ignore my post. I'll try to find another solution.

    Thanks all nevertheless. :)
  • krikikriki Member, Moderator Posts: 9,118
    At a certain moment, when you decide to refresh the record,you can just put:
    RecordReference.FIND('=');
    
    I am not sure if after that you need to do again to have the new fieldvalue in the fieldreference:
    FieldReference := RecordReference.FIELD(SomeFieldID);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.