Increment temporary value and and assign

Here is my event

I am counting the number of rows in the row-find and storing it in a temporary dataview field dvFilter.RowCount. I have confirmed that this value gets stored each time I execute the button click. In the condition i check to see if the value of dvFilter.RowCount is greater than 0. This is working

Next when I see that dvFilter.RowCount is greater than 0 I want to increment that stored value and assign it to the value of SplitID in a different data view, dvUpdate.SplitID.
All attempts to increment to increment this value and display in this new row have resulted in something that resembles this

but should be the number 2 in this case.

Here is the JSON value statement in the row-add

I have been working on this for a day now with no success. Any Suggestions?

Try putting the curly brackets around only your dataview.column:

"Calculated_SplitID": "{dvFilter.RowCount} +1"

This part, {dvFilter.RowCount}, should return your current row count.

also I would try
{dvFilter.RowCount} > 0

Mine actually works for the condition check.

Got closer with your suggestion. But still not a number

You said dvFilter was a temporary dataview right? I know with transview it seems like any field you define on the fly gets stored as a string. Maybe you can define RowCount in the dataview and make it an Int so you can do math on it?

1 Like

Are you sure…

1 Like

Yup

Did that from the start and confirmed that there was a value in there from the get go before trying to increment it.

Show where you set it.


This is the KMH that displays the alert

1 Like

Tested yours and it works as well.

Maybe just ditch the double quotes altogether? I tried doing a test with the row-update widget and just putting {dataview.column}+1 in the expression field worked.

If removing the quotes doesn’t work you could add a row then update it with row-update.

For some reason the + sign is being interpreted as a string not an operator.
{
“Calculated_SplitID”: “{dvFilter.RowCount} + 1”
}

Change this:

Into this:

{
“Calculated_SplitID”: {dvFilter.RowCount} + 1
}

5 Likes

Javascript?

“Calculated_SplitID”: {dvFilter.RowCount} + parseInt(1, 10)

SWAG here.

1 Like

@cory.davis

I added this back into the Row Update and then the add row with
{
“Calculated_SplitID” : “{dvFilter.RowCount }”
}

Worked… Thanks for your help!!!

1 Like