Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Managed associations with XSDS

$
0
0

Hello all,

 

i'm sure i've done this before, but i just can't get the key...

 

I've got this CDS file with these two entities, defined as follows:

 

@Catalog.tableType: #COLUMN

Entity "group" {

key id: Integer64 not null;

name: Association to model.translation not null;

description: Association to model.translation;

parent: Integer64 null;

editable: Integer not null default 1;

status: Integer not null default 0;

user_id: Association to model.user;

key version: Integer not null default 1;

date: UTCTimestamp not null;

};

 

 

@Catalog.tableType: #COLUMN

Entity translation {

key id: Integer64 not null;

en: String(5000);

fr: String(5000);

de: String(5000);

it: String(5000);

es: String(5000);

zh: String(5000);

ko: String(5000);

ru: String(5000);

jv: String(5000);

ar: String(5000);

pt: String(5000);

ja: String(5000);

};

 

When i see the schema generated with my hdbdd file, i get this:

 

BIGINT


1

id

 

FIXED

(X1)

X

 

 

To select row, press SPACEBAR

2

name.id

BIGINT

 

FIXED

 

X

 

 

To select row, press SPACEBAR

3

description.id

BIGINT

 

FIXED

 

 

 

 

To select row, press SPACEBAR

4

parent

BIGINT

 

FIXED

 

 

 

 

To select row, press SPACEBAR

5

editable

INTEGER

 

INT

 

X

1

 

To select row, press SPACEBAR

6

status

INTEGER

 

INT

 

X

0

 

To select row, press SPACEBAR

7

user_id.id

BIGINT

 

FIXED

 

 

 

 

To select row, press SPACEBAR

8

version

INTEGER

 

INT

(X2)

X

1

 

To select row, press SPACEBAR

9

date

TIMESTAMP

 

LONGDATE

 

X

 

 

 

So I want to show the name of the group:

 

        var lang = "en";

 

        var MyEntity = XSDS.$importEntity("package", "model.group");

       

        // retrieve entity instance

   

        var query = MyEntity.$query();

       

        var results = query.$execute();

   

       

        $.response.setBody(JSON.stringify(results[0].name[lang].toString()));

 

 

But get this error:

 

results[0].name[lang] is undefined


i also tried results[0].name.id[lang], and many other things...

 

i must be missing something here, but i'm getting nuts...

 

many thanks in advance!

 

Luis


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>