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

Insert into Sub Element of Data Schema

Avatar

Avatar
Validate 1
Level 1
michellec1024
Level 1

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
michellec1024
Level 1

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 3
Boost 1
View profile
michellec1024
Level 1

05-11-2019

Hi,

I am trying to insert data into an attribute that's under a sub element.

Here is the part of the script where I define what to insert:

  var event =

    <exampleEvent

      xtkschema = "exp:exampleEvent"

      _operation = "insert"

      deliveryTitle = {deliveryTitle}

    />

Here is an example of my data schema:

  <element name="exampleEvent">

    <element name="subExamples">

      <attribute label="Delivery Title" name="deliveryTitle" type="string"/>

    </element>

  </element>

If I were to take the 'deliveryTitle' attribute out of the subelement 'subExamples', then I am able to see data populate in the 'deliveryTitle' column. However, once I place the 'deliveryTitle' attribute into the sub element, data no longer populates.

Please advise.

Thanks,

Michelle

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile
Jyoti_Y
MVP

05-11-2019

Hi,

Add data like you have defined your XML:

xtk.session.Write(

<exampleEvent  xtkschema = "exp:exampleEvent"    _operation = "insert">

< subExamples deliveryTitle = {deliveryTitle}/>

</exampleEvent> );

Thanks.

Answers (2)

Answers (2)

Avatar

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile
Jyoti_Y
MVP

05-11-2019

Hi,

You should define it as:

  <exampleEvent

      xtkschema = "exp:exampleEvent"

      _operation = "insert"

      subExamples.deliveryTitle = {deliveryTitle}

    />

Your data will be saved in correct field.

Thanks.

Avatar

Avatar
Validate 1
Level 1
michellec1024
Level 1

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
michellec1024
Level 1

Likes

3 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 3
Boost 1
View profile
michellec1024
Level 1

05-11-2019

Thanks for the reply. I’ve tried that and it didn’t work for me. The data did not show up in the field.

The data only shows up if I remove <element name=“subExamples”>....</element> from the data schema.