Why is there no response?
I want to display the corresponding data after clicking the button, but 1 and 2 did not work. I verified with code 3 and it is correct. Where is the problem? Thank you for your reply.
6 replies
-
Looking at 1 and 2 you don't need the contains() command. Since each record in "copy here" has only 1 value for name you can do a simple equal.
let s := this; select 'copy here' where name = text(s.name)
You only need the contains() if each record in 'copy here' could return multiple names, if you had a multichoice or a reference field.
I am encountering a bug with your DB that I can't reproduce in my other DBs. If I edit a record in 2, it disappears from the view. Even if I do inline editing of a record in the view element the record disappears. It reappears if I reselect the dynamic choice.
Even if I create a new Page it does the same thing. Weird.
-
said:
What's even stranger is that the same code works fine in the database in the Public Cloud, but no data is returned offline).I'm not sure what you mean by this. I uploaded your DB to my public cloud and I get nothing in the view element when I select a choice or two in the dMC. I also did uploaded it to my local device and it did the same thing.
So you changed from a dynamic choice to dynamic multi choice in the HOME table. That changes things.
One way to modify the code is:
let s := this; let y := for loop1 in numbers(xxx) do record('copy here',loop1).name end; select 'copy here' where (var n := name; count(y[= n]) > 0)
Why are lines 2 - 4 there? If you create a formula field and put the code, as I did in the field "3":
debugValueInfo(text(xxx))
You will see:
string("rice, vegetables, fruits")
If you create another formula field and put:
let s := this; let y := for loop1 in numbers(xxx) do record('copy here',loop1).name end; debugValueInfo(y)
You will see:
string(["rice","vegetables","fruits"])
The big difference is the square brackets around the data. That tells you Ninox sees the data as an array where just doing text() does not create an array. Using arrays is a much cleaner way of working.
But Ninox didn't always worked with arrays in contains() so how would you have solved it before the change?
Just wrap the text() in a concat(). So the view element code would look something like:
let s := this; select 'copy here' where contains(concat(text(s.xxx)), name)
Now things should start working.
Content aside
- Status Answered
- 9 mths agoLast active
- 6Replies
- 72Views
-
2
Following