DMXzone Server Connect Support Product Page

Answered

How to access current record after database query

Asked 11 Feb 2016 05:01:34
4
have this question
11 Feb 2016 05:01:34 rich sale posted:
Is there a cheat sheet for the data structure following database queries?

If I run a database query as an initial step to see whether the record exists
How can I then set a value to the id of the record found so that I can use it in a database update step.


I have found that I can use {{dataset.identity}} after a database insert. But where are these things documented.

Replies

Replied 21 Mar 2017 22:16:45
21 Mar 2017 22:16:45 Hans Haverlach replied:
I think I've got a similar question.
First I query a table.
Then I want to use the first record ID from that table as the filter value for an update query.

I thought of creating a SetValue step. But I don't see a possibility to assign this first record ID to the SetValue.
Someone any suggestions/ideas??
Replied 22 Mar 2017 07:12:47
22 Mar 2017 07:12:47 Teodor Kuduschiev replied:
Hi Hans,
In order to get a specific result from a query in server connect you just need to:

1. Add and filter your query
2. Add a repeat after the query, and use {{queryName}} as a repeater expression
3. In the repeater step, add whatever action you need and you will see the binding from the query repeat.
Replied 22 Mar 2017 07:37:54
22 Mar 2017 07:37:54 Hans Haverlach replied:
Yes I thought of using A repeater.
But I only need the first record.
How can I Limit the first query to have only the first record? In MySql I use LIMIT 1, but I don't know how to do that in App connect.
Or can I stop the repeater after 1?
Replied 22 Mar 2017 07:51:04
22 Mar 2017 07:51:04 Teodor Kuduschiev replied:
You can use server connect data formatter and format the expression for the repeater to just return first or last record from your query.
Replied 22 Mar 2017 07:56:11
22 Mar 2017 07:56:11 Hans Haverlach replied:
Okay, that is cool. I never thought of using the formatter for this.
Thank you!
Replied 22 Mar 2017 08:05:20
22 Mar 2017 08:05:20 Teodor Kuduschiev replied:
You are welcome.
One of the main purposes of Server Data Formatter is to be able to do this

Reply to this topic