0

Create a view based on contains

Hi all,

I have a table "Guidance" and in that table I have a multiple choice field named "keywords". Now I want in another table to create a view based on a textfield "keyword selection" - my idea was the following :

let Xngl := 'keyword selection';
select Guidance [contains(concat('keywords', Xngl))]

The problem is that the only thing I can get Ninox to accept is the following :

contains(select Guidance.keywords,'keyword selection') - but this leaves me with a blank view.

 

Anyone who are able to help here ?

regards

Leo

3 replies

null
    • Fred
    • 8 hrs ago
    • Reported - view

    You can try:

    let Xngl := lower('keyword selection');
    select Guidance [contains(lower(text(keywords)), Xngl)]
    

    Since you are allowing users to type in their own words in 'keyword selection, you need to make sure you make all of the text either lower or upper case.

    Why not have the field keyword selection also be a multi-choice field that matches the keyword field in Guidance? That way you have more control and can use the selection number instead.

      • Leo_Woer
      • 6 hrs ago
      • Reported - view

       Hi fred - sounds perfect - I could easily have Keyword selection as multi choice - then how should I the match them ?

      • Fred
      • 5 hrs ago
      • Reported - view

       Now that we are trying to compare two arrays (one from Guidance and one in your other table) we need to do some extra work. You can learn more from this post that  shared. 

      The code would look something like:

      let Xngl := numbers('keyword MC');
      select Guidance [var MC1 := numbers(keywords);
          count(Xngl[var v := this;
              contains(MC1,v)])>0]
      

      Line 1: points to the new keyword multi-choice field in the other table.

      Line 2: we create a variable called MC1 to store the selections from the keywords multi-choice field.

      Lines 3 & 4: we then breakdown the keyword MC array into its individual items so we can compare it to the numbers in the keyword array.

Content aside

  • 5 hrs agoLast active
  • 3Replies
  • 19Views
  • 2 Following