String filtering with Ax7 oData gives error - odata

I am trying to use the Ax7 oData endpoints to search for sales quotations by Name. Using equality works just fine, but the more advanced filter functions gives me errors.
This simple EQ query works OK:
https://myAx7Server/data/SalesQuotationHeaders?$filter=SalesQuotationName eq
'Sparrow Retail'
But this query gives me the error "The type 'System.String' for the query operator is not Queryable!"
https://myAx7Server/data/SalesQuotationHeaders?$filter=startswith(SalesQuotationName,'S')
Am I doing something wrong, or is it just that these oData endpoints do not support searching by string?

Found the answer here: https://ax.help.dynamics.com/en/wiki/dynamics-ax-7-services-technical-concepts-guide/#odata-services
This is implemented as a wildcard character Example: http://host/service/EntitySet?$filter=StringField eq '*retail*'

Related

Excel Power Query: Passing parameter to oDataFeed URL throws error

When a direct number for the TestPlanID is given it works.
When passing the value from sheet to a Query and then appending it to URL throws an error.
Expression.Error: We cannot apply operator & to types Text and Number.
Details:
Operator=&
Left=https://analytics.dev.azure.com/OrgName/ProjName/_odata/v3.0-preview/TestPoints?$apply=filter((TestSuite/TestPlanId eq
Right=39128
Can you try
eq"""&varTPID&"""
If value of varTPID is an integer/decimal, can you change the first line in power query to varTPID=Text.From(varTestPlanID) and then use eq"""&varTPID&"""
Also I think, TestPoints?"&"$apply needs to be changed to TestPoints?$apply

Microsoft Graph - calendarview filter case-insensitive tolower

I need to filter calendar views on their case insensitive subject as returned by Microsoft Graph API.
What I have tried so far:
I have confirmed that a case sensitive filter functions: filter=startswith(subject,'mystring')
I get an error when I add tolower to my query string: filter=startswith(tolower(subject),'mystring')
I even get an error by just using teh tolower function in the filter: filter=tolower(subject) eq 'mywholestring' which I think might indicate that tolower is not suported.
Yet I found broad use of tolower in the OneNote documentation: https://learn.microsoft.com/en-us/graph/onenote-get-content
This is the OData reference: https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752358
I also have hard times with MS Graph case sensitivity, but here is a temporary workaround that I'm using:
https://my.site.name/_api/web/siteusers?$filter=substringof('Adam', Title) or substringof('adam', Title)
Maybe that will give you some ideas.

Is there a way to get only subscription for a user?

I am wondering if there is a way to query for subscription with a filter based on creatorId ? When I use $filter=creatorId eq guid string
I get a response of
A binary operator with incompatible types was detected. Found operand
types edm.string and edm.guid for operator kind ‘equal’
I also tried guid’xx...’ or guid[‘xxx...’] both with no luck
As the property is a string the query would be looking like this.
GET /v1.0/subscriptions?$filter=creatorid eq '844735a2-5360-4d79-b3d6-dd6aa4f567ee'
However, filtering is not supported on this property.

Jira Rest Api JQL isnt working using &

Iam using the Jira Rest Api to read data from our Jira-System. In most cases this works fine but i have a problem if & is in query.
I try following query:
http://jira-test.meinServer.de/rest/api/2/search?jql=labels="F&E"
which produces this error message:
"Fehler in der JQL-Abfrage: Die Zeichenfolge mit Anführungszeichen 'F' wurde nicht abgeschlossen. (Zeile 1, Zeichen 8)"
in englisch:
"Error in JQL-Syntax: The string with 'F' isn't closed. (line 1, char 8)"
I found that & is the problem. But i can't find some workaround or documentation how to escape this.
Someone got a solution for this?
You didn't encode your query string properly. Try: http://jira-test.meinServer.de/rest/api/2/search?jql=labels%3D%22F%26E%22
Reference
The part of an URI caught between ? and # characters is called the query string (the part after # is called fragment). Often the query is a sequence of key–value pairs (laid out as {key}={value}) separated with the & character.
If you analyze the URL you provided and split it by & you'll see that in fact you are passing two parameters in your query string:
parameter jql with a value of labels="F
parameter E" with no value
The second parameter is ignored as this particular REST endpoint doesn't expect it. As you can now clearly see you are passing a malformed JQL in your URL. It's because you want to include a special character in your JQL query.
To make it possible you have to properly encode your JQL. This is a common problem and most of the platforms provide tools to do that. Here are examples for JavaScript, C# and Java.
Click here to learn more about the query strings.

OData not operator, or how to filter for all items which not startswith(...)

I am using the SharePoint REST API, which is similar to OData, but currently I don't even know the standard OData way. I would like to filter items that do not start with a certain string pattern. How is the 'not' operator written in OData? All references list 'and' and 'or' operators and 'ne' operators, but I cannot find one for 'not'.
Neither of the following work:
a)
not startswith(field, 'pattern')
b)
startswith(field, 'pattern') ne true // Yes I know there is no 'true' boolean literal.
Even though the diagram from Use OData query operations in SharePoint REST requests illustrates that the proper syntax for startswith operator is:
filter=startswith(PropertyName, 'String') Eq Boolean
it seems the only syntax it accepts is:
filter=startswith(PropertyName, 'String')
For example, the request:
/_vti_bin/listdata.svc/Pages?$filter=startswith(Title,'SharePoint') eq false
returns pages those Title does not start with SharePoint
But the same request using _api service endpoint
/_api/Web/Lists/getByTitle('Pages')/items?$filter=startswith(Title,'SharePoint') eq false
returns The query is not valid exception.
Solution
Utilize listdata.svc endpoint since it fully supports the syntax of startswith operator as specified in OData specification.

Resources