web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

int64 to string in D365FnO

(0) ShareShare
ReportReport
Posted on by 1,215

Hi all,

Num1.PNG

As shown in the picture above , I want to while a clicking "transaction number sequence" 

should be like : below picture.

Num2.PNG

its inserted, now the question is i want to insert numbersequence code against.

below code,

private void createNumSeqTable(NumberSequenceCode _numberSequence, name _txt,NumberSequenceFormat _format)
       {
            NumberSequenceTable numberSeq;
            MPTransactionSeqNum  seq;
            MenuItemMessageAction menuItemMessageAction = new MenuItemMessageAction();

            select firstonly numberSeq
                where numberSeq.NumberSequence == _numberSequence;

            numberSeq.initValue();
            numberSeq.NumberSequence = _numberSequence;
            numberSeq.Txt = _txt;
            numberSeq.Continuous = NoYes::Yes;
            numberSeq.Format = _format;
            numberSeq.NextRec = 1;
            numberSeq.Lowest = 1;
            numberSeq.Highest = 999999;
            if(!numberSeq.RecId)
            {
                numberSeq.insert();
            }
            else if(numberSeq.NumberSequence || numberSeq.Txt || numberSeq.Format)
            {
                throw Error(strFmt("Numbser sequence already exists: %1,%2,%3", numberSeq.NumberSequence, numberSeq.Txt, numberSeq.Format));
            }
            menuItemMessageAction.MenuItemName(menuItemDisplayStr(NumberSequenceDetails));
            menuItemMessageAction.RecId(numberSeq.RecId);
            menuItemMessageAction.TableName(tableStr(NumberSequenceTable));
            str jsonData = FormJsonSerializer::serializeClass(menuItemMessageAction);
            Message::AddAction(MessageSeverity::Informational, "Number sequence created successfully", numberSeq.NumberSequence, MessageActionType::DisplayMenuItem, jsonData);
        }

Clicked method,

public void clicked()
    {
       // NumberSequenceTable numberSeq;
    
        //select firstonly numberSeq
           // where numberSeq.RecId == MPTransactionSeqNum.TransNumSeq;
    
        this.createNumSeqTable("USMF-OATN","Addintion","USMF-OATN");
        this.createNumSeqTable("USMF-OCTN","Cost","USMF-OCTN");
        this.createNumSeqTable("USMF-LETN","Leave Encash","USMF-LETN");
        this.createNumSeqTable("USMF-ABTN","Absence","USMF-ABTN");
        this.createNumSeqTable("USMF-TETN","Ticket Encash","USMF-TETN");
        this.createNumSeqTable("USMF-ODTN","Deductions","USMF-ODTN");
        this.createNumSeqTable("USMF-OTTN","Overtime","USMF-OTTN");
        this.createNumSeqTable("USMF-WATN","Warning","USMF-WATN");
        this.createNumSeqTable("USMF-LOTN","Loan","USMF-LOTN");
        this.createNumSeqTable("USMF-EOSN","EOS","USMF-EOSN");
        this.createNumSeqTable("USMF-VACN","Leave","USMF-VACN");
        this.createNumSeqTable("USMF-LRTN","Leave Return","USMF-LRTN");
        this.createNumSeqTable("USMF-BTTN","Business trip","USMF-BTTN");
      
        super();
        MPTransactionSeqNum_ds.research(true);
        MPTransactionsSetup_ds.research(true);
       
    }

i want to etc: numberSeq.NumbersequenceCode = MPTransactionSeqNum.TransNumSeq;

but in the  "TransNumSeq" field int64 i don't how to insert please give me solution.

And where to insert this line "numberSeq.NumbersequenceCode = MPTransactionSeqNum.TransNumSeq; as i motioned above code".

Thanks 

I have the same question (0)
  • Riyas ahamed F Profile Picture
    1,215 on at

    correction :  numberSeq.Numbersequence = MPTransactionSeqNum.TransNumSeq;

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    int642str/str2int64

    docs.microsoft.com/.../xpp-conversion-run-time-functions

  • ergun sahin Profile Picture
    8,826 Moderator on at

    numberSeq.Numbersequence = int642str(MPTransactionSeqNum.TransNumSeq);

  • Verified answer
    Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    Your description is very confusing.

    I guess that the table used in the form is actually MPTransactionSeqNum, is that correct? If so, then you want to do the opposite thing than what you wrote in your code - you want to set the value of MPTransactionSeqNum.TransNumSeq. Do you agree?

    You mentioned that the type is int64, but you omitted all information about its EDT and table relations between MPTransactionSeqNum and NumberSequenceTable. My assumption is that MPTransactionSeqNum.TransNumSeq contains a RecId of NumberSequenceTable, therefore your code should be this:

    mpTransactionSeqNum.TransNumSeq = numberSeq.RecId;

    But I'm guessing most of the things. It would really help if you provided a much description of your problem. Doing that is in your best interest, therefore please pay more attention to it.

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    If I'm not guessing wrong, there is a custom number sequence table. You are trying to open 12-13 records in numberSeqTable with the button for each record. You will use the value in the custom table(transNumSeq) to avoid confusing records. It's okay if you use the code as I wrote it, but it's hard to say the same for the process. How do you manage so many numberSeqTable records? It feels like you're doing the job in reverse.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for replay Ergün Şahin, and Martin Dráb sir,

    As i mentioned first picture is MPTransactionSetup in our an own form.

    Two dataSource :-

    1.MPTransactionsSetup

    2.MPTransactionSeqNum

    And in MPTransactionSeqNum table and standard NumberSequenceTable both table has in relation.

    Now, the question is i want to insert   (MPTransactionSeqNum.TransNumseq =  NumberSequenceTable ?

    As i mentioned the code still i'm not using "(MPTransactionSeqNum.TransNumseq =  NumberSequenceTable ? "  where to put is an exactly place .

    Note: once i clicked generate numberserquence  "TransNumseq" field should be like

    etc;

    bussiness trip : USMF-BTTN

    Loan               : USMF-LOTT

    .........

    .......

    issue : as i mentioned the code in tranNumSeq i select in lookup its showing (USMF-BTTN) i don't want select

    once generate TransNumSeq should be :USMF-BTTN remaining field based on a Transaction type based insert so that how to do in same method ? please give me the example.

    Additional information : Mr. Ergün Şahin,

    "It feels like you're doing the job in reverse."  No i did it only special form in numberseq by default value remaining all in ISV form as usually Generated in number sequence. :)

  • Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    I'm sorry, but I don't understand what you're saying.

    Anyway, you said that there is a relation between MPTransactionSeqNum and NumberSequenceTable, therefore that's the place where you can see how they're related. Expand the relation node and see which fields are used from each table.

    I suspect that you have no idea about the reference group control. It's used when a reference to RecId (= int64) is stored in database, but other (user-friendly) fields are shown in GUI. I guess that this is what it used in your form. Simply look at the definition of the control in AOT to know if it's the case.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans