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

Writing work table data in a Temp Table

Avatar

Avatar
Level 1
varshtus
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
varshtus
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
varshtus
Level 1

16-09-2020

Hi -

 

I have created a Temp table via JS in my workflow and want to insert data from the working table in that temp table, is it possible?

 

If yes can you help me with JS for it?

 

Regards,

Tushar Varshney 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

258 likes

Total Posts

372 posts

Correct Reply

152 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

258 likes

Total Posts

372 posts

Correct Reply

152 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile
DavidKangni
MVP

16-09-2020

Hi,

 

You may fetch temp schema like this:

var schemaName = vars.targetSchema.substr(vars.targetSchema.indexOf(":") + 1);

logInfo(schemaName);

var query = xtk.queryDef.create(

<queryDef schema = {vars.targetSchema} operation = "select">

<select>

<node expr = "@firstName"/>

<node expr = "@lastName"/>

<node expr = "@email"/>

<node expr = "@id"/>

</select>

</queryDef>);

If you are sure in this above, you may try this for writing:

var some_variable = <vars.targetSchema.split(':')[1]

xtkschema = vars.targetSchema

_key="@id"

_operation="Update"

lastName = {record.lastName }

firstName={record.firstName}

email = {record.email }

/>;

xtk.session.Write(some_variable);

Thanks,

David

Answers (2)

Answers (2)

Avatar

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

115 likes

Total Posts

327 posts

Correct Reply

100 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

115 likes

Total Posts

327 posts

Correct Reply

100 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile
_Manoj_Kumar
MVP

21-09-2020

Hello @varshtus ,

 

I am assuming you have created a temp table with the JS and it is not created by any activity.

 

To read the data from the previous activity and store it in the temp table you can use this javascript code.

//reading the data rom the previous activity
var query = xtk.queryDef.create(<queryDef schema={vars.targetSchema} operation="select"><select><node expr="@id"/><node expr="@COLUMN1"/></select></queryDef>);
var resultSet = query.ExecuteQuery();


// Writing the data into the temp table

for each (var row in resultSet) {
     var COLUMN1= row.@COLUMN1;   
     var pId= row.@id;         
     sqlExec("INSERTO INTO TEMP_TABLE_NAME values("+COLUMN1+","+pID+"));
}

 

Let me know if that works.

 

Thanks

 

 

 

Avatar

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

154 likes

Total Posts

910 posts

Correct Reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

154 likes

Total Posts

910 posts

Correct Reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile
Sukrity_Wadhwa
Employee

01-10-2020

Hi @varshtus,

Were you able to resolve this query with any of the given solutions? Do let us know.

Thanks!