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, ...
Unanswered

How to Pass Null Value in Range

(0) ShareShare
ReportReport
Posted on by 20

ApproveStatus.PNG

If you see the above picture as example, in this form I want Records that have any value but Not "Posted" value in Enum.

this.query().dataSourceName(formDataSourceStr(XYZ_PayrollWorkspaceWorkerMissingAllTimesheetsPart, ProjMissingHourRegView)).addRange(fieldNum(XYZ_ProjMissingHourRegView,ApprovalStatus )).value(SysQuery::valueNot(TSAppStatus::Ledger));

So, I apply this range (code attach above) on init Method of Form Data Source

but after this code Form Does not show any Record 

like this

1447.Form.PNG

I have the same question (0)
  • GirishS Profile Picture
    27,827 Moderator on at

    Hi Syed,

    Try to convert Enum to string while adding range.

    ProjMissingHourRegView)).addRange(fieldNum(XYZ_ProjMissingHourRegView,ApprovalStatus )).value(SysQuery::valueNot(enum2str(TSAppStatus::Ledger)));

    Thanks,

    Girish S.

  • Syed Abdul Moiz Hashmi Profile Picture
    20 on at

    Hi Grilish,

    I tried this also but the Result is still the same.

  • GirishS Profile Picture
    27,827 Moderator on at

    Try to the add the query output to info log and check. Also on your query form data source name is ProjMissingHourRegView and table name is XYZ_ProjMissingHourRegView. Check whether both are same.

    Also, if it's a custom form try adding your range in executeQuery method of datasource before super call.

    public void executeQuery()
    {
        ProjMissingHourRegView_ds.queryBuildDataSource().addRange(fieldNum(ProjMissingHourRegView, ApprovalStatus)).value(SysQuery::valueNot(enum2Str(TSAppStatus::Ledger)));
        info(strfmt("%1",Sample_ds.queryBuildDataSource().tostring()));
        super();
    }

    Thanks,

    Girish S.

  • Syed Abdul Moiz Hashmi Profile Picture
    20 on at

    I tried this Also and the answer is still the same.

  • GirishS Profile Picture
    27,827 Moderator on at

    Try printing the query to infolog. If possible, you can paste the query here. Please refer to my previous code.

    If it's a view you can directly add the range to that Approval status field. Under range node click on "New range" - Select "Approval status" in the field property - In the value property set !Ledger

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,827 Moderator on at

    I want the query where you printed from executeQuery method.

    Thanks,

    Girish S.

  • Syed Abdul Moiz Hashmi Profile Picture
    20 on at

    The Code Is here 

    this.query().dataSourceName(formDataSourceStr(XYZ_PayrollWorkspaceWorkerMissingAllTimesheetsPart, ProjMissingHourRegView)).addRange(fieldNum(XYZ_ProjMissingHourRegView, ApprovalStatus)).value(SysQuery::valueNot(enum2Str(TSAppStatus::Ledger)));
                info(strfmt("%1",ProjMissingHourRegView_ds.queryBuildDataSource().toString()));
                super();  

  • GirishS Profile Picture
    27,827 Moderator on at

    Can you paste the output of the info log here where you have added the query ouput.

    Also, you are adding the code inside the DataSource of form, so no need to mention the formdatasourcestr. Please refer to the code I have sent.

  • Syed Abdul Moiz Hashmi Profile Picture
    20 on at

    Select FirstFast ForUpdated * From XYZ_ProjMissingHourRegView(ProjMissingHourRegView) where ((Worker = 5637216825) OR(Worker = 563721835)) And ((PeriodFrom>={ts'2022-08-01 00:00:00.000'} AND PeriodFriodFrom>={ts '2154-12-31 00:00:00.000'})) AND ((PeriodTo<={ts '2022-08-14 00:00:00.000'})) And ((NOT(ApprovalStatus = 6 )))

    the Output in Info is above, and I also Changed the code as you mentioned but nothing work.

  • GirishS Profile Picture
    27,827 Moderator on at

    In timesheet there will be no worker recid - Only there will be resource recid. Worker field will be there but there will be no values.

    Are you sure your view has worker recid and it has value in it?  

    Also, Enum value 6 will be referring to "Transferred" status.

    Can you check the query again or please paste the whole code here.

    Why there is 2 And range added to period from?

    Thanks,

    Girish S.

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans