0

Create records from dynamic multiple choice

Hi guys, 

I hit a bump trying something new: 

I have a dynamic multiple choice field called 'Keuze kritieke fases'

I have a subtable 'Kritieke fases'. 

I have a button that I gave following code on click: 

let xCurrRec := Id;
for i in 'Keuze kritieke fases' do
    let j := (create 'Kritieke fases');
    j.(Omschrijving := text(i));
    j.(Projecten := xCurrRec)
end

 

So the goal is to have the multiple choice list as an easy way to quickly input a few records (1 record per 'Kritieke fase'), but still be able to tweak the field 'Omschrijving' depending on the case. 

Except I'm getting a very strange output... (Image below, I select 3 choices, I get one empty record and one with 3 completely different choices concatenated). Anyone ideas?

14 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view
    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view
      • Joren_Brouillard
      • 2 yrs ago
      • Reported - view

      RoSoft_Steven 

      I think the difference between yours and mine is that I need the information from a MULTIPLE choice field, and I need to create one record per selected choice. In your example you create one record and populate different fields with different choice fields. 

      Did I explain that clearly? English is not my mother tongue... :)

      • Ninox partner
      • RoSoft_Steven.1
      • 2 yrs ago
      • Reported - view

      Joren Brouillard 

      Ik dacht dat u records wou maken vanuit een dynamic multiple choice field. Dit is exact wat de tabel 'Fill Lines with DMC Fields' doet. Dit is misschien niet uw exacte 'use case' maar kan u wel een idee geven hoe dit kan.

      Aarzel zeker niet om mij te contacteren bij verdere vragen.

      Steven

      • Joren_Brouillard
      • 2 yrs ago
      • Reported - view

      RoSoft_Steven 

      Dag Steven, 

      Foutje van mijn kant, ik had niet door dat de magie in een trigger after update zat.

      Hiermee is het gelukt, dit had ik nooit zelf kunnen uitvogelen! Hartelijk dank!

      • Ninox partner
      • RoSoft_Steven.1
      • 2 yrs ago
      • Reported - view

      Joren Brouillard 👍

    • Kruna
    • 2 yrs ago
    • Reported - view

    Hi guys,

    I am sorry to reopen this post, but I would need some help please, although I am not very sure if its possible. This post was most similar regarding to my issue that I could find.

    I didnt understand the last part unfortunately, so please excuse if I ask an already answer. 😬

    I added a small test db for better understanding.

    What I would like to achieve is when chosing two or more categories in table dmcf_table, that all the items from subcategories show up, eg Cars and Bike --> BMW, Mercedes, Toyota, Honda, Kawasaki, Suzuki.

    Is that doable?

     

    Thanks a lot for taking time.

     

    Kruna

    • Fred
    • 2 yrs ago
    • Reported - view
    Kruna said:
    What I would like to achieve is when chosing two or more categories in table dmcf_table, that all the items from subcategories show up, eg Cars and Bike --> BMW, Mercedes, Toyota, Honda, Kawasaki, Suzuki.
    Is that doable?

    Most things are doable in Ninox. Take a look at the uploaded DB to see the changes.

    I'll also uploaded the changes here:

    let myCat := for loop1 in numbers(CATEGORY) do
            record(Category,loop1)
        end;
    (select Subcategory)[var k := Kategorie;
        count(myCat[= k]) > 0] order by Text

    The thing to remember with multi choice fields (regular or dynamic) is that once you choose the 2nd choice you now have more than one result so you can't just use the equal sign.

    So I had to change your first variable to a for loop command so I can create an array of the choice(s) you made.

    Then I can use that array in your select statement to find all records in Subcategory that have at least one of the items checked in Category.

    You can view this post for more info.

    I think it is best to start a new post instead of reopening one.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 yrs ago
      • Reported - view

      Fred 

      Hi Fred, I try to use the formula to others Subcategory like Subcategory_2, etc but the formula don't work.

      I send A sample DB as example.

      • Kruna
      • 2 yrs ago
      • Reported - view

      Fred good morning,

      thank you very much! It works prefectly like a charm here on my end!

      Yes, its amazing, what Ninox can do. Although using it few years already I am still in elementary while you guys are studied. :-)

      I really appreciate all the help and support getting here from great people.

      Of course, next time and I will do better and open a thread instead of reopening a post. I was not sure whether do or not, so I apologize.

      thx

      Kruna

    • Fred
    • 2 yrs ago
    • Reported - view
    Rafael said:
    Hi Fred, I try to use the formula to others Subcategory like Subcategory_2, etc but the formula don't work.
    I send A sample DB as example.

    I don't see anything wrong. When I select anything in Subcategory 1 the proper records show up in Subcategory 2.

    I don't understand the need for the Category field if there is only 1 choice.

    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 yrs ago
    • Reported - view

    The Category is the first level (The name of Project, only one element) the SUBCATEGORY 1 had 3 elements, but when use the formula for SUBCATEGORY 2 don't work, there are something bad in my formula, and I have 4 SUBCATEGORY.

    let myCat := for loop1 in numbers('SUBCATEGORY 1') do
            record('WBS_1',loop1)
        end;
    (select WBS_2)[var k := 'Kategorie 1';
        count(myCat[= k]) > 0] order by Id

     

    When select Engineering I saw all elements on Engineering, Procurement, & Construction.

    • Fred
    • 2 yrs ago
    • Reported - view
    Rafael said:
    When select Engineering I saw all elements on Engineering, Procurement, & Construction.

     I don’t see any problems on my end. When I select Engineering I only see Engineering. When I select Procurement I only see Procurement. When I select Construction I only see Construction. And when I select combinations the proper combinations show up.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 yrs ago
      • Reported - view

      Fred Thanks again Fred a WBS with 5 Level work perfect.

Content aside

  • 2 yrs agoLast active
  • 14Replies
  • 434Views
  • 5 Following