Replace field contents by formula

Discussion created by Stu412 on Nov 22, 2017
Latest reply on Nov 22, 2017 by Stu412

Hi there

I have a scenario where I use a find to make certain records either visible or invisible to the user in a found set.  The criteria for this is achieved by a RowVisibility text field and a simple Y/N notation.  I currently have a script running this which, when a green button on the row is clicked, changes the Y to an N, and vice versa for a red button.  For PDFing, the rows are omitted completely, but remain greyed out onscreen so you can turn them back on again. 


For each row visible to the user (say RowID = 10), there are actually up to 4 unique rows on the table in the background.  The layout groups by RowID and therefore we get the calculations required and only one row visible.  My current script only works on the current row in focus that the user clicks, which can leave in this example, 3 RowID 10's still with 'Y' on them, which means overall the RowID10 will remain visible by virtue of the fact 3/4 are still Y when searched for.


I would like to do something like the script below using ReplaceField Contents.  However it's not working right, for those RowIDs which are not needed to change, as it simply replaces any existing Y or N with a Null / space / empty, which is no good.  The following should run on clicking the green/red button per row:


If [Table::RowVisibility = "Y"]

Set variable [$Row = RowID]

Replace Field Contents [RowVisibility ; Case ($Row = RowID ; "N")]

Halt Script

Else If

If [Table::RowVisibility = "N"]

Set variable [$Row = RowID]

Replace Field Contents [RowVisibility ; Case ($Row = RowID ; "Y")]

Halt Script


I need the Case statement to be something like:  Case $Row = RowID ; "N", otherwise don't do anything to anything else!


Thanks in advance