microsoft / microsoft/Power-Fx

Lookup of SQL Datasource with >= Date Comparison Errors

Open
#841 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

I'm experiencing the issue described here. This is my code:

UpdateContext({
    note: LookUp(SiteHistory, CreatedDate >= Today())
});

which gives the not so helpful error:

Service call was successful. However, there was a problem processing the server response. Please refresh your data source and republish the app

This code does not error:

UpdateContext({
    note: LookUp(SiteHistory, CreatedDate = Today())
});

but obviously returns blank since the created date will have a time portion.

Is there a work around for this, or potentially a way to fix it? If not, can the error give a more specific error?

UPDATE
Changing the code to this:

UpdateContext({
    note: First(Sort(Filter(SiteHistory, CreatedDate >= Today()),
        CreatedDate, Descending)
    )
});

If(note.CreatedDate < Today(),
    UpdateContext({
        note: Blank()
    });
);

Gives a much better error:

The requested operation is invalid.
Server Response: SiteHistory failed: We cannot apply operator < to types DateTimeZone and DateTime.
inner exception: We cannot apply operator < to types DateTimeZone and DateTime.
clientRequestId: f7d704ae-cd33-42bc-8d17-bebc1779ea79

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the LookUp(SiteHistory, CreatedDate >= Today()) expression against the SQL datasource, then compare it with the equality and updated Filter/Sort examples in the issue. Trace the resulting server-response and DateTimeZone-versus-DateTime errors; done means the comparison either works for the datasource or reports a specific, actionable diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.