on 08-19-2015 5:27 PM
Hi,
I have two tables with following structures. I need to get a deep structure with association.
SALES
("REGION_ID" INTEGER CS_INT, "PRODUCT_ID" INTEGER CS_INT, "SALES_AMOUNT" DOUBLE CS_DOUBLE, PRIMARY KEY ("REGION_ID", "PRODUCT_ID"))
REGION
("REGION_ID" INTEGER CS_INT, "REGION_NAME" VARCHAR(100), "SUB_REGION_NAME" VARCHAR(100), PRIMARY KEY ("REGION_ID"))
I have created a xsodata service with following syntax
service {
"<Schma>"."REGION" as "Region" navigates ("Region_Sales" as "RegionItem");
"<Schma>"."SALES" as "SalesItem";
association "Region_Sales" with referential constraint principal "Region"("REGION_ID") multiplicity "1"
dependent "SalesItem"("REGION_ID") multiplicity "*";
}
The output is as shown below. The data in detail section is empty.
I want the output to be with all detailed data as shown below in green.
results: [
{
__metadata: {
__deferred: {
},
REGION_ID: 100,
PRODUCT_ID: 2,
SALES_AMOUNT: "90"
},
....
]
}
Could you please let me know how to achieve this?
Best Regards
Srini
Hello Srini,
because you are just accessing the Region entity set you just get the data of it. To achieve what you want and to get also the RegionItems for the Regions in one call you have to use "expand".
Call your service like following:
.../hanatut.xsodata/Region?$expand=RegionItem&$format=json
Then you get the Regions incl. RegionItems in JSON format.
Best Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.