JS to return schema?

Avatar

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile
RaulOcana
Level 3

21-06-2019

Hi guys,

Is it possible to Query a schema, send it to a Javascript to apply a <where> condition and then return the schema result, therefore send it to another flow activity? I have tried it without result.

Here's my js

query = xtk.queryDef.create(

  <queryDef schema={vars.targetSchema} operation="select" distinct="true" noLineCount="1">

    <select>

      <node expr="@field1" alias="field1"/>

    </select>

    <where>

      <condition expr={"@field1='" + localVar + "'"}/>

    </where>

  </queryDef>);

resultSet = query.ExecuteQuery();

return resultSet;

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

984 likes

Total Posts

1,097 posts

Correct reply

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

Avatar
Establish
MVP
wodnicki
MVP

Likes

984 likes

Total Posts

1,097 posts

Correct reply

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

21-06-2019

Hi,

Communication between activities can only happen over text (/json serializations).

Instead of that code you could fork the transition ahead of the js activity, then invert the query to delete, i.e.:

sqlExec("delete from " + vars.tableName + " where sField1 <> '" + localVar + "'");

The outgoing transition will then have the desired result set.

Thanks,

-Jon

Answers (3)

Answers (3)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

984 likes

Total Posts

1,097 posts

Correct reply

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

Avatar
Establish
MVP
wodnicki
MVP

Likes

984 likes

Total Posts

1,097 posts

Correct reply

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

21-06-2019

Just the temp results, or a copy of the temp results if you fork ahead of the activity- depends on what you're trying to do.

Avatar

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile
RaulOcana
Level 3

21-06-2019

Alright, thank you Jon!

Avatar

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile

Avatar
Give Back
Level 3
RaulOcana
Level 3

Likes

14 likes

Total Posts

58 posts

Correct reply

4 solutions
Top badges earned
Give Back
Validate 25
Validate 10
Validate 1
Boost 5
View profile
RaulOcana
Level 3

21-06-2019

Hi Jon,

So you mean that I have to delete the records that doesn't match with the criteria from the "temp" result, right? That will only affect the temp results or it will delete it from the actual schema?

Thank you!

-Raúl