on 10-07-2014 6:09 AM
Hi Experts,
I am using one ODATA service in my SAPUI5 application. Below is my Service URL -
http://yyy.yyy.yyy.com:0000/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$filter=Action eq 'COUNT' and Fdate eq '12.12.2014' and Tdate eq '12.12.2014' and Bukrs eq '1001' and Pernr eq '123456'
My oDATA is working fine and fetching data when I am testing. But I am facing one problem when I am executing my application. When my application hitting the service URL, one extra string added at last position in my service automatically. The new service is looking like -
http://mmkndslp1.corp.mahindra.com:8000/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$filter...
Due to this, I think my ODATA could not fetch data and giving error. The error is - Left hand expression of memberaccess operator invalid.
How to handle this case? Kindly suggest on this case.
Any kind of possible solution would be highly acceptable.
Thanks in advanced.
Regards,
Arindam Samanta.
Hi Arindam,
The $count should appear before the ? and the filter after like this:
sap/opu/odata/sap/<Gateway service/<EntitySet>/$count?$filter=Status%20eq%20%27With%20Manager%27
Example taken from UI5 generating the $count call with a filter.
Not sure what's generating your URL with $count in that position.
Cheers,
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
I have added as you suggested. But in my case it is returning the value 0 as there is no records. So it is returning the total number of records available. But how to fetch the records if I used filter option in service URL when I am used in SAPUI5 application?
Kindly suggest on this matter. Expecting your expertise..
Regards,
Arindam
Hello Arindam,
The error is valid as its a wrong URI convention.
I see that $count is not supported with filters.Not sure about it.
If u want that feature where u need to know the count of the data fetched and also the data in the response u need to use $inlinecount=allpages.
Where u will get the count which u send from backend in the response along with the fetched data.
Additional implementation is required for this.
U need to send the count as per ur requirement as below in DPC level.
ES_RESPONSE_CONTEXT-INLINECOUNT = <Count Number>
Sample ->
/sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/get_details_Set?$filter=UserId eq '00001'&$inlinecount=allpages
Response ->
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http:///sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<id>http:///sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/get_details_Set</id>
<title type="text">get_details_Set</title>
<updated>2014-10-07T05:35:18Z</updated>
<author>
<name/>
</author>
<link href="get_details_Set" rel="self" title="get_details_Set"/>
<m:count>1</m:count>
<entry>
<id>http:///sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/get_details_Set('00001')</id>
<title type="text">get_details_Set('00001')</title>
<updated>2014-10-07T05:35:18Z</updated>
<category term="ZGW_ZAM_GET_EMP_DETAILS_SRV.get_details" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="get_details_Set('00001')" rel="self" title="get_details"/>
<content type="application/xml">
<m:properties>
<d:UserId>00001</d:UserId>
</m:properties>
</content>
</entry>
</feed>
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashwin,
As you suggested, I have added the &$inlinecount=allpages at end. Below is my new URL -
http://localhost:XXXX/SodexoVersion2/proxy/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$fil...
But now getting new error -
Invalid system query options value
Kindly suggest about this.
Regards
Arindam.
Hello Arindam,
In the below URL which u shared, u r adding both $count and $inlinecount=allpages in a single URL.
I don't think u can use both in a single URL. Not possible.
http://localhost:XXXX/SodexoVersion2/proxy/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$fil...
U can either use $count or $inlinecount=allpages.
So please use appropriate URL as per ur requirement.
if u want to know the count of the data fetched and also the data in the response, u need to use $inlinecount=allpages.
/sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/get_details_Set?$filter=UserId eq '00001'&$inlinecount=allpages
If u want only count and no data then below is URL ->
/sap/opu/odata/sap/ZGW_ZAM_GET_EMP_DETAILS_SRV/get_details_Set/$count?&$filter=UserId eq '00001'
U can decide based on ur use case.
Regards,
Ashwin
Hi Ashwin,
$count is automatically added at the end. I checked as you and Matt suggested. But when I am using the URL in my application, $count automatically added at the end of the URL as I told in my previous post.
I am passing the url like -
http://yyy.yyy.yyy.com:0000/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$filter=Action eq 'COUNT' and Fdate eq '12.12.2014' and Tdate eq '12.12.2014' and Bukrs eq '1001' and Pernr eq '123456'&$inlinecount=allpages
After execution URL is like below -
http://yyy.yyy.yyy.com:0000/sap/opu/odata/sap/ZAS_SODEXO_SRV/SODEXO_DISBURSE_SET?$filter=Action eq 'COUNT' and Fdate eq '12.12.2014' and Tdate eq '12.12.2014' and Bukrs eq '1001' and Pernr eq '123456'$inlinecount=allpages/$count
Any idea on this? or how can I use filter option to get the records in SAPUI5 apps?
Regards,
Arindam Samanta.
Hi experts,
Is there any solution available for this problem? I am waiting for solution.
Actually I am using filter option in my odata service url. This is being used in SAPUI5 application. When executing the application, the $count is automatically added at the end position in my service url and I am not getting data. The error is coming - Left hand expression of memberaccess operator invalid.
Kindly suggest to resolve this issue. Is there any possible solution where I can use ODATA URL with filter option in my SAPUI5 application?
Thanks in advanced.
Regards,
Arindam.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The problem is the / character before the $count. Even if you do this.oModel.setDefaultCountMode(sap.ui.model.odata.CountMode.None); the / character remains.
I had this problem when I tried to use a navigation property to retrieve a data for a table/list.
I have yet to resolve this. Perhaps someone has an answer:
My code:
<List growing="true" growingScrollToLoad="true" id="list" items="" mode="{device>/listMode}" noDataText="{i18n>masterListNoDataText}" select="onSelectAtt"> | ||||||||||
<items> | ||||||||||
<ObjectListItem number="{FileSize}" numberUnit="bytes" press="onSelectAtt" title="{FileName}" type="{device>/listItemType}"/> | ||||||||||
</items> | ||||||||||
</List> | ||||||||||
Hello Arindam,
Yes please follow what Matt suggested. Its working that way and only count is returned. But not the data.
@Matt Harding Thank you for the solution to resolve the error
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are binding odata to UI5 control like table, it will by default call teh $count parameter. in that case, you are not supposed to specify your filers in URL like this.
Sree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.