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

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

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,884 Most Valuable Professional on at

    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);
    }

  • WillWU Profile Picture
    22,361 on at

    Hi amr,

    Please try to use the enum2Str().

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

    Hope this helps.

  • Verified answer
    amr abdelaziz Profile Picture
    95 on at

    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;

    }

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi amr,

    What do you try to achieve?

    Best regards,

    Ludwig

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    405 on at

    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'.  

  • amr abdelaziz Profile Picture
    95 on at

    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

  • nmaenpaa Profile Picture
    101,160 Moderator on at

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

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 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 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