Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

(0) ShareShare
ReportReport
Posted on by 95

hi all
Wrong type of argument for conversion function.

str  mystr;

mystr=any2str(GeneralJournalEntry.JournalCategory);

if(mystr == "Purchase Order")
{
SSRS_MyReport = new MenuFunction(menuItemOutputStr(ForVendByDPPrintGenJoural),MenuItemType::Output);
}

what is the correct statement

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    This seems to be a completely new issue, so please post a new question.

  • amr abdelaziz Profile Picture
    amr abdelaziz 95 on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    hi Ludwig Reinhard

    I've create 2 ssrs reports one for puch and one for sales to print the voucher from

    LedgerTransVoucher form

    so i create a buttom in in the form with cliced method

    void clicked()

    {

    MenuFunction SSRS_MyReport;

       Args Args;

       str journalid ="";

          Switch (GeneralJournalEntry.JournalCategory)

        {

         case  LedgerTransType::Purch:

         SSRS_MyReport = new MenuFunction(menuItemOutputStr(ForVendByDPPrintGenJoural),MenuItemType::Output);

         break;

         case LedgerTransType::Sales :

         SSRS_MyReport = new MenuFunction(menuItemOutputStr(ForCustByDPPrintGenJoural),MenuItemType::Output);

         break;

         default :

         break;

        }

       Args = new Args();

       journalid = "Dataset1_journalNumbar=" +GeneralJournalEntry.JournalNumber;  

       // Assign parameters to report

       Args.parm(journalid);

       // Run the report

       SSRS_MyReport.run(Args);

         super();

    }

    but the journal number not passed to the report parameter

    is this good idea or there is preferable one and why the journal number not passed to the report parameter

    i have to copy it and pest in the report

    thanks

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    Vishal Dhavgaye 405 on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    Above code with switch statement look okay to me.

    Please make sure you also cover default case by throwing an error like 'Invalid transaction type'.  

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    Hi amr,

    What do you try to achieve?

    Best regards,

    Ludwig

  • Verified answer
    amr abdelaziz Profile Picture
    amr abdelaziz 95 on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    thanks Martin Dráb

    i do this and it is ok

    Switch (GeneralJournalEntry.JournalCategory)

    {

      case  LedgerTransType::Purch:

         SSRS_MyReport = new MenuFunction(menuItemOutputStr(ForVendByDPPrintGenJoural),MenuItemType::Output);

         break;

      case LedgerTransType::Sales :

         SSRS_MyReport = new MenuFunction(menuItemOutputStr(ForCustByDPPrintGenJoural),MenuItemType::Output);

         break;

      default :

        break;

    }

  • WillWU Profile Picture
    WillWU 22,352 on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    Hi amr,

    Please try to use the enum2Str().

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

    Hope this helps.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,476 Most Valuable Professional on at
    RE: mystr=any2str(GeneralJournalEntry.JournalCategory);-Wrong type of argument for conversion function.

    Don't use strings - using the enum is not just easier, but also much safer.

    if (generalJournalEntry.JournalCategory == LedgerTransType::Purch)
    {
    	ssrs_MyReport = new MenuFunction(menuItemOutputStr(ForVendByDPPrintGenJoural), MenuItemType::Output);
    }

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,784 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,476 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans