Manipulating RecordID

PaluxoPaluxo Member Posts: 3
Hello!

Hi need to create several func to convert some navision data types into a text data type.

I'm creating a func RecordIDToText that converts a recordID into a text, but I can't manipulate a recordId in C/AL to create and test my func.
I'm need to know how make an attribution to a recordId and who to manipulate it.

Can u guys please help me.

Answers

  • MTCMTC Member Posts: 159
    Sorry, but I'm not quite sure what exactly you are trying to do?
  • DenSterDenSter Member Posts: 8,307
    Use FORMAT to transform any datatype in NAV to a text representation.

    I don't know what you mean by 'RecordID' though
  • kinekine Member Posts: 12,562
    RecordID is property of RecordRef variable, which will return you the ID of the record, for example "SalesPrice: Item, XXXX,All Customers,,01.02.06,,,PCS,0". It means, that the record ID includes: "Table name: PK fields values". You can transform this RecordID into text in common way (using FORMAT).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • PaluxoPaluxo Member Posts: 3
    MTC wrote:
    Sorry, but I'm not quite sure what exactly you are trying to do?

    I was triing to convert a RecordID (one of the navision data types) into a string. My problema was that i could not create a recordId with valid data to do the tests. Its necessary to use a RecordRef to get a recordId

    Exemple:

    Customer.RESET;
    IF Customer.FIND('-') THEN BEGIN
    RecRef.GETTABLE(Customer);
    RecID := RecRef.RECORDID;
    END;

    My problem is SOLVED thanks guys :wink:
  • kinekine Member Posts: 12,562
    Than please, add the [SOLVED] prefix into starting post subject...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • GoMaDGoMaD Member Posts: 313
    Paluxo wrote:
    MTC wrote:
    Sorry, but I'm not quite sure what exactly you are trying to do?

    I was triing to convert a RecordID (one of the navision data types) into a string. My problema was that i could not create a recordId with valid data to do the tests. Its necessary to use a RecordRef to get a recordId

    Exemple:

    Customer.RESET;
    IF Customer.FIND('-') THEN BEGIN
    RecRef.GETTABLE(Customer);
    RecID := RecRef.RECORDID;
    END;

    My problem is SOLVED thanks guys :wink:

    Is the other way round possible?

    I mean: when I have a recordID, how can I use this to get a record through a recordvariable (instead of a RecordRef)

    is is as simple as the following code?
    RecRef.get(RecID);
    RecRef.SETTABLE(Customer);
    

    And do I need a find statement right after the settable?

    Tested it myself, and yes it is that simple and you don't need a find statement right after teh settable line.
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
Sign In or Register to comment.