Updating other records on POST

This +1 thing is a Wappler bug. It has been reported earlier as well, from what I remember.

To get this working, delete everything in the value field, and type this manually:
{{PriorityValue + 1}}

Thanks @sid for that info. I tried that, but still not success.

I really don’t know where this thing is failing. Is there a way to debug it step by step? Some break point debugging would be very helpful.

What i have suggested is just the set value part. That has worked for me. Could be that you have some other issue.

For debugging, I just disable all the steps, then run the server action repeatedly by enabling steps one by one.

How can you tell if a given line has been successfully ran and what the values are? For example, in the check_tasks query, how can I see the results of that query?

Enable Output.

A debugging option I find very useful is see the actual query being executed in the query log. Whether or not this is an option will depend on your set up, but in case it’s relevant, there is an an old thread about this.

(While it’s possible to see the queries within Wappler, using the terminal, as suggested in the thread, I actually prefer to use a text editor on another monitor to display the queries as they’re run.)

Thanks for those suggestions. I tried enabling Output, but I couldn’t see what that did. Can you tell me how to use it, @sid?

And @TomD, I tried running those commands too, but couldn’t get any results. Where is the query log? Can you elaborate a little on how it works? It looks like a powerful debugging tool, but not sure how to use it.

It depends… I’m using MySQL witih WAMP, on a Windows machine. By default the query log is not generated; you wouldn’t want it enabled it on a production database. I added this in my.ini:

[mysqld]
; port = 3306
; enables SQL queries to be logged
general_log = on
general_log_file=C:\wamp64\logs\mysql_query.log

… and restarted the server. I think that’s all that’s needed.

Once you enable output, just call the SA directly in the browser, and see the query result as output.
In case you don’t see anything, it means the condition you have above this query did not evaluate to true. Or, it could be that the query is not returning any rows.

I’ve done that with GET requests, but this is a POST request. How do I do that in a browser?

Oh yes. Sorry.
For POST you can use an app like Postman.
Or, you can create a form with Post method in Wappler and see the output in Network tab of browser dev tools.

I’ve used Postman before so might give that a try.
But I am getting some output now in the dev tools, under network and the Preview tab.
It appears like for starters, it’s not reading the check_tasks query results correctly. I inserted a Set Value step (TaskCount) and set it’s value to the count of the query and turned it’s output on:
image

And this is the results I’m getting in the dev tools:

As you can see the TaskCount is zero, but if I run the query in SSMS, I get 3 rows.
image

How do I correctly read the results of the query?

I think you have Debug selected. If so, try deselecting it and try again:

image

Yes, I turned Debug off and now getting results! Not sure what Debug is for, but one thing it seems to do is disable the query results.

It outputs the query itself, not the results. It doesn’t work for paged queries. Also, it will show parameters, not actual values. To show the actual query, as executed, you would need to look at the query log.

I got it to update the first record in the list of records that need to be updated, but then it quits.

My api now, with the condition in question outlined in red:

It doesn’t appear to be updating the second Set Value step after the condition inside the repeat, so the condition is false for each subsequent loop.

Is there some other variable to use so that it gets updated correctly?

Can someone please help me out on this? I’ve been working on this for days and am still stuck… and can’t find any documentation on the repeat action.

What is the right way to increment the value for each integration of the repeat? That seems to be where it’s failing. It updates the first record, but then doesn’t keep that value for the condition to check against the next record. It compares it with the original value instead.

@patrick or @Teodor could you take a quick look at this? In my last post with an image, the Set Value in the highlighted section is not keeping its value from one iteration of the repeat to the next. Thanks!

Can anyone verify that a Set Value can be updated inside a repeat and the updated value compared in a condition within the same repeat? See highlighted image in pervious post.