Hi!
I am attempting to simply select memo type field from a schema, but the javascript activity keeps throwing an error that "@description" is undefined. It seems to be related to the type of the attribute rather than a syntax error.
Can anyone point me in the direction of how to solve this? Thank you very much in advance!
Error:
29/11/2022 11:37:25 SOP-330011 Error while executing the method 'ExecuteQuery' of service 'xtk:queryDef'.
29/11/2022 11:37:25 XTK-170036 Unable to parse expression '@description'.
29/11/2022 11:37:25 Attribute 'description' unknown (see definition of schema 'Series (kap:series)').
Schema:
<element desc="Series" label="Series" labelSingular="Series" name="series">
<dbindex name="sId" unique="true">
<keyfield xpath="@sId"/>
</dbindex>
<key internal="true" name="sId">
<keyfield xpath="@sId"/>
</key>
<attribute desc="The alphanumeric ID of the series." label="Id" name="sId" type="string"/>
<attribute desc="The title of the series." label="Title" length="150" name="title"
type="string"/>
<element desc="A longer description." label="Descripton" name="descripton" type="memo"/>
<attribute desc="The channel this series was broadcast on." label="Channel Code"
length="100" name="channelCode" type="string"/>
<attribute desc="URL for the information of the series" label="URL" length="400"
name="url" type="string"/>
<attribute desc="Series Image URL" label="Series Image URL" length="400" name="mediaLocationUri"
type="string"/>
<attribute default="GetDate()" label="InsertOrUpdatedDateinAdobe" name="InsertOrUpdatedDateinAdobe"
type="datetime"/>
</element>
Code:
var query = xtk.queryDef.create(
<queryDef schema="kap:series" operation="select">
<select>
<node expr="@url"/>
<node expr="@description"/>
</select>
<where>
<condition expr={"[@description] IS NOT NULL" }/>
</where>
</queryDef>
)
var result = query.ExecuteQuery();
logInfo(result);
for each(var res in result){
logInfo(res.@description);
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @SorenDP
Still the issue persists? This is weird.
Apologies for the typo in the code .
var query = xtk.queryDef.create( <queryDef schema="kap:series" operation ="select"> <select> <node expr="@url"/> <node expr="description"/> </select> <where> <condition expr={"description IS NOT NULL" }/> </where> </queryDef>
I am pasting a sample code which i used to retrieve a memo field. Please have a look.
Regards
Views
Replies
Total Likes
Hi @SorenDP
Memo Fields will not be accessed by giving '@' because when try to see the display advanced field you won't be able to see '@' instead it just gives the name. Hence you can try the below code.
var query = xtk.queryDef.create( <queryDef schema="kap:series" operation ="select"> <select> <node expr="@url"/> <node expr="description"/> </select> <where> <condition expr={"[description] IS NOT NULL" }/> </where> </queryDef> )
var result = query.ExecuteQuery(); logInfo(result); for each(var res in result){ logInfo(res.description); }
Regards
Thanks for the answer! Unfortunately I still get the exception:
29/11/2022 12:49:48 SCR-160012 Javascript: error while evaluating script 'PWKF5224/js'.
29/11/2022 12:49:48 SOP-330011 Error while executing the method 'ExecuteQuery' of service 'xtk:queryDef'.
29/11/2022 12:49:48 XTK-170036 Unable to parse expression 'description'.
29/11/2022 12:49:48 Element 'description' unknown (see definition of schema 'Series (kap:series)').
Views
Replies
Total Likes
Hi @SorenDP
Could you please check if the schema has been committed to the database through Update DataBase Structure?
Also in the structure tab of your schema, you may find 3 dots on right hand side below corner
, please click on that and see what's the name adobe has generated for the desired memo field. (I guess it should be description, but please check for confirmation.)
Regards
Views
Replies
Total Likes
Hi! I checked all the above. The db structure has been updated, and the adobe generated name is "description". Hmmm.
Views
Replies
Total Likes
Hi @SorenDP
Still the issue persists? This is weird.
Apologies for the typo in the code .
var query = xtk.queryDef.create( <queryDef schema="kap:series" operation ="select"> <select> <node expr="@url"/> <node expr="description"/> </select> <where> <condition expr={"description IS NOT NULL" }/> </where> </queryDef>
I am pasting a sample code which i used to retrieve a memo field. Please have a look.
Regards
Views
Replies
Total Likes
I am a huge Moron. SORRY! I see now that the name of the field in the schema is "descripton" and not "description"..... Sooooo.
Sorry that you spent time on this, but still thanks a lot!!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies