cancel
Showing results for 
Search instead for 
Did you mean: 

XSOdata Association

0 Kudos

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: [

{

},

....

]

}

Could you please let me know how to achieve this?

Best Regards

Srini

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

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

0 Kudos

Hi Florian,

Excellent.. Thanks a lot for your help.

Best Regards

Srini

Answers (0)