Replacing one value in a field with another value for records that match
I think I must be approaching this problem in the wrong way but ..
I have a table which contains a numeric value. I want to replace all occurences of the number 1 with the number 0 for all record where this field currently contains the number 1. I have, so far, found this impossible to do. Ninox wants to replace any record which has the number 1 anywhere within it. What am I doing wrong ?
7 replies
-
There are a couple of ways that I know of. You can use "Update Multiple Records", select "Assign calculated value" and use this formula...
if NumberField = 1 then
number(replace(text(NumberField), "1", "0"))
else
NumberField
end
You can attach this code to a Button or run it in the Console...
for r in select YourTable do
if r.NumberField = 1 then r.(NumberField := 0) end
end
-
@sean I am trying to use
replace('E-mail', "<", "")
in Trigger after update but this replace function is not working in my case. I actually want to get string between these brackets <somestring>. Is there any solution for this? -
Dev twentyZen, you can do something like this…
replace('E-mail, "<", "<" + somestring)
-
replace(extractx('E-mail', "(?=\<)(.*?)(?=\>)"), "<", "")
-
Hi Uwe,
It looks like you just added pattern matching to Dev's misuse of the replace function. From the manual...
Both of you are just replacing "<" with an empty string.
-
Hello Sean
You are actually right about that.
The correct regex would be:
(?<=\<)(.*?)(?=\>).
However, Ninox cannot do a 'positive lookbehind' in this case.
Therefore: (?=\<)(.*?)(?=\>).
The "" in replace(extractx(title, "(?=\<)(.*?)(?=\>)"), "<", "") does not create a space , but replaces the < character with 'nothing', so removes the < character. -
Well, that's an interesting explanation, but it's irrelevant for the stated requirement.
Content aside
- 2 yrs agoLast active
- 7Replies
- 1689Views