Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

runbase batch queryrange values not retained properly ???

(0) ShareShare
ReportReport
Posted on by 5,125

runbase batch query range values not retained properly , i am trying  to pass range that is select by the user with other locked range i used in my coded query as below code and image 

_InitQuery=new Query();
_QueryBuildDataSource=_InitQuery.addDataSource(tableNum(Payslip));

_PaidRange=_QueryBuildDataSource.addRange(fieldNum(Payslip,Paid));
_PaidRange.value(queryValue(PaidPayslip::No));
_PaidRange.status(RangeStatus::Locked);

_PostedRange=_QueryBuildDataSource.addRange(fieldNum(Payslip,Posted));
_PostedRange.value(queryNotValue(PostedPayslip::Posted));
_PostedRange.status(RangeStatus::Locked);

_PaySettled=_QueryBuildDataSource.addRange(fieldNum(Payslip,Settled));
_PaySettled.value(queryValue(NoYes::No));
_PaySettled.status(RangeStatus::Locked);

_Queryrun=new SysQueryRun(_InitQuery);

is is the payment statement is not retain and assigned to the query in run time execution 

any suggestion or help is appreciated

 

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: runbase batch queryrange values not retained properly ???

    I think you should implement one more line of code

    _QueryBuildDataSource.clearRanges();

    as third line and before adding any query ranges in your above code.

    This will basically clear all the default ranges and system will show only your applier ranges

    Please verify and let me know if you need more details and technical support

  • PA-22040759-0 Profile Picture
    PA-22040759-0 6,194 on at
    RE: runbase batch queryrange values not retained properly ???

    You problem is most likely related to the serialization and deserialization of the object that goes on when the framework saves the values from the dialog. So in AX terms, it's a problem with how your class uses the Pack and Unpack methods.

    Could you please let us know where the code you have listed is located? Is it in main for example?

    And could you post contents of your Pack and Unpack methods?

  • Suggested answer
    RE: runbase batch queryrange values not retained properly ???

    Look for the sys last value thing, your value is not getting initialized correctly.

  • RE: runbase batch queryrange values not retained properly ???

    Hello,

    just to make sure I understand your problem: The range you highlighted in your screenshot is neither set by code nor by the user, so it should not be there?

    In this case the range might be loaded from your usage data (SysLastValue). Have you tried resetting your usage data? When using a SysOperationController you can explicitly specify not to use the SysLastValue table.

    Best regards

    Dennis

  • mostafa mahmoud Profile Picture
    mostafa mahmoud 5,125 on at
    RE: runbase batch queryrange values not retained properly ???

    any suggestions???

  • DaxNigel Profile Picture
    DaxNigel 2,572 on at
    RE: runbase batch queryrange values not retained properly ???

    You need to ensure the variable that stores the value is included in the class declaration cache control. This is how the batch job stores the information at execution time. You should be able to once the job in on the batch queue open the parameter screen and see the parameter set correctly. If you can not then the cache variable has not be saved correctly.

    If you need more help can you post you class declaration of the batch job.

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,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans