Query nms:service extended attributes in javascript

nigxu

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)

Answers (0)