Split Function Help
hi to all!
I have got this tables in Ninox:
TABLE: Genres
Field: Genre
TABLE: Masters
Field (in error): Genre
The field in TABLE Master can have 1 or more Genres, for example
(1 genre)
(2 genres)
With the formula:
Here is the formula field:
let xGenre := "";
if Genres = null then xGenre := "" else xGenre := Genres end;
let g := first(select Genres where Genre = xGenre);
html(---
<span style="color: black">Genre: </span>
<span onclick="ui.openRecord('{ g }')"; style="color: #1E90FF; cursor: pointer; text-decoration: underline;">{ xGenre } <br></span>
---)
I am trying to have the possibility to link this field to the table called "Genres".
this correctly open the related record in the Table "Genres" only if the field in the table "Master" has one genre (first case), but do not work if genres are more than one.
I have tried to split the xGenres, but I have no chance.
Any help would be appreciated, as always
Thank you
37 replies
-
said:
Yes works, but how can I do for include more fieldsGoing off of my example this is how my code changes:
let list := ( let x := split(Text, ","); for item in x do let i := first(select Table1 where Country = item); " <span style=""color: black"">Country: </span> <span onclick=""ui.openRecord('" + raw(i) + "')""; style=""color: #1E90FF; cursor: pointer; text-decoration: underline;"">" + i.Country + "</span> <span style=""color: black"">Number: </span> <span onclick=""ui.openRecord('" + raw(i) + "')""; style=""color: #1E90FF; cursor: pointer; text-decoration: underline;"">" + i.Number + "</span> " end ); html("" + list + "")
As you can see I drop the use of the for loop variable: item and just use the variable: i to get my information. Also I had to move the static text out of the html() command and into the for loop so it get created for each instance. Then you just duplicate the same bit of code for the first link then change the static name and the field references.
-
said:
you can share this example. need to know what happend, everything's look fineThis is what I have:
let list := ( let x := split(Text, ","); for item in x do let i := first(select Table1 where Country = item); " <span style=""color: black"">Country: </span> <span onclick=""ui.openRecord('" + raw(i) + "')""; style=""color: #1E90FF; cursor: pointer; text-decoration: underline;"">" + i.Country + "</span> <span style=""color: black"">Number: </span> <span onclick=""ui.openRecord('" + raw(i) + "')""; style=""color: #1E90FF; cursor: pointer; text-decoration: underline;"">" + i.Number + "<br></span> " end ); html("" + list + "")
Try putting your <br> inside the <span></span>.
Content aside
- Status Answered
- 1 yr agoLast active
- 37Replies
- 412Views
-
5
Following