Expand my Community achievements bar.

SOLVED

JS entity get and load fail but create and save work

Avatar

Level 2

Hi everyone,

I use  NLWS.nmsRecipient.get(id); and NLWS.nmsRecipient.load(id); in order to retrieve some data but there is always errors when i do it on nmsRecipient

QUE-370014 Erreur lors de la génération de la requête (sur un document de type 'Destinataires (nms:recipient)').

But when i make a create + save on nmsRecipient it works perfectly. 

According to another error also raised, i understand that the issue probably come from nmsRecipient schema extension but i don't understand why exactly .

 XTK-170036 Impossible d'analyser l'expression '@RepBranch-id'.

 

Does someone know how to deal with that ? 

Thank you,

Quentin, 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Your join is not properly created.

You are getting error related to RepBranch foreign key not present in Recipient Schema.

Can you check definition of Recipient Schema( Preview tab) and verify whether @RepBranch-id column is created or not.

If not, please specify specific join condition between two tables. They are not able to join with primary key.

 

Thanks,

Jyoti

View solution in original post

10 Replies

Avatar

Community Advisor

Hello @quentinm9832912 

 

Can you please more details on the code you are using?

 

XTK-170036 Impossible d'analyser l'expression '@RepBranch-id'.

 

The above error means your xpath is not correct 


     Manoj
     Find me on LinkedIn

Avatar

Level 2
var test = NLWS.nmsRecipient.get(11470200); logInfo(test.firstname)

Avatar

Community Advisor
Can you check if the recipient extension table is published?

     Manoj
     Find me on LinkedIn

Avatar

Level 2
Yes, it's published, here the schema simplified for security purpose : <srcSchema entitySchema="xtk:srcSchema" extendedSchema="nms:recipient" img="nms:recipient.png" label="Destinataires" mappingType="sql" name="recipient" namespace="lme" xtkschema="xtk:srcSchema"> <element img="nms:recipient.png" label="Destinataires" labelSingular="Destinataire" name="recipient"> <element label="LME" name="lmeProject"> <!-- ATTRIBUTES --> ... <!-- END ATTRIBUTES --> <!-- LINKS --> <!-- Branch --> <element integrity="neutral" label="Branch" name="RepBranch" revCardinality="single" revLabel="LME" revLink="LME" target="lme:RepBranch" type="link"/> <!-- END LINKS --> </element> </element> </srcSchema>

Avatar

Community Advisor
The code looks ok, Can you please share the screenshot of the error?

     Manoj
     Find me on LinkedIn

Avatar

Community Advisor
Do you have a join between RepBranch and Recipient table? If yes, that is where you have an error.

     Manoj
     Find me on LinkedIn
I have lme wich is an extension of nmsRecipient and this extension has several relation with table. But none of those has a link to nmsRecipient. I have commented this link relation in the extension then the error changed to another relation and it continued like this again and again. Big issue here, i cannot break everything because it's still used , so i am gonna make without entity even if it's longer..Maybe it's impossible to use load or get with schema extented with table links. Thanks for your help

Avatar

Correct answer by
Community Advisor

Hi,

 

Your join is not properly created.

You are getting error related to RepBranch foreign key not present in Recipient Schema.

Can you check definition of Recipient Schema( Preview tab) and verify whether @RepBranch-id column is created or not.

If not, please specify specific join condition between two tables. They are not able to join with primary key.

 

Thanks,

Jyoti

Avatar

Level 2

Hello, i come back here because i finally managed to find why load don't works. 

2 reasons : 

Firstly, we have one nms recipient schema extension.  

And the schema contains an high level <element> that contains all attributes for that schema extension. 

Wich result on the following appereance on the tool request. (white square)

quentinm9832912_0-1592984922755.png

And so this "free element" prevent the mapping tool to suceed when load is called. 

 

The second issue concern the link element "revcardinality", if you use "single" and the relation with id does no exists then the load operation crashes. 

 

I hope that could help someone one day, 

Thanks you all for your help !