Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Query nms:service extended attributes in javascript

Avatar

Avatar
Level 1
nigxu
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
nigxu
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
View profile
nigxu
Level 1

09-02-2020

Hi experts,

I have extended nms:service data schema as below XML:

<srcSchema _cs="Services (acxwc)" created="2019-12-11 07:48:17.195Z" createdBy-id="0"
           desc="Services to which recipients can subscribe" entitySchema="xtk:srcSchema"
           extendedSchema="nms:service" img="" label="Services" labelSingular="Service"
           lastModified="2020-02-09 14:40:09.848Z" md5="6D8EC334ED48AEE518F68BF4638515EE"
           modifiedBy-id="0" name="service" namespace="acxwc" xtkschema="xtk:srcSchema">
  <enumeration basetype="byte" default="mail" name="messageType">
    <value desc="WeChat channel" img="acxwc:wechat-icon20x20.png" label="WeChat"
           name="wechat" value="21"/>
  </enumeration>
  <element desc="Services to which recipients can subscribe" label="Services" labelSingular="Service"
           name="service">
    <element name="WeChat">

      <attribute advanced="false" label="App Id" length="120" name="appId" type="string"/>
      <attribute advanced="false" label="Secret" length="220" name="secret" type="string"/>
      <attribute advanced="false" label="Qr Scene" length="220" name="qrScene" type="string"/>
      <attribute advanced="false" label="Account Type" length="255" name="accountType"
                 type="string"/>
    </element>
  </element>
</srcSchema>

and in my javascript activity, given an serviceId of a service & subscription data record, i want to use query like   :

    var acq = xtk.queryDef.create(
      <queryDef schema="nms:service" operation="select">
        <select>
          <node expr="WeChat/@appId"/>
          <node expr="WeChat/@secret"/>
        </select>
        <where>
          <condition expr={"[@serviceid]='"+accountId+"'"}/>
        </where>
      </queryDef>);
    var qres = acq.ExecuteQuery();
    var appId = qres[0].@appId;
    var secret = qres[0].@secret;

but it always throws an exception says:

Cannot parse expression: @appId

Looks like the query definition xml i have was wrong, Could anyone please help on this? or shed a document on how to query nms:service extended attributes would be nice too.

 

thanks,

nigel,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

976 likes

Total Posts

1,096 posts

Correct Reply

514 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

976 likes

Total Posts

1,096 posts

Correct Reply

514 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

10-02-2020

Hi,

 

<node expr="[WeChat/@appId]"/>
<node expr="[WeChat/@secret]"/>

 

Are you making a WeChat channel?

 

Thanks,

-Jon

Answers (0)