0

Separate multiline text field into individual rows?

Hello!

We're beginners in Ninox and want to build a database to manage a book library. We think we can use the Ninox template "Inventory" and adapt it to our needs. However, in the "Client Orders" input form, we need to be able to add multiple sales items at once, rather than adding them one by one.

Our books are supplied with RFID tags so that a big pile can be scanned in one batch. We’d like to be able to paste the full list of RFID codes into one "client order" rather than having to search for each book individually in order to add them.

We think we can use the "multiline text field" for this, and later map the list of RFID codes to our inventory. In order for this to happen, the multiline text field list needs to be separated into rows – how can this be done?

Many thanks for any feedback :-)

5 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    You can use the split() function which will return an array. Something like this...

     

    newArr := split(MultilineField, "

    ")

     

    Use the count() function to get the total array items and use the item() function to access each array item. Note, arrays start with an index of 0.

     

    https://ninox.com/en/manual/calculations/reference-of-functions-and-language

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

    Made this example which build records ('Text' -field contains the lines from the content) in a Subtable 'Lines' from the content of the multiline Textfield.

     

    Steven

    • emma
    • 4 yrs ago
    • Reported - view

    Sean and Steven, 

    Many many thanks for your help! This code we could never have figured out by ourselves. It works perfectly! This system is amazing :-)

    • emma
    • 4 yrs ago
    • Reported - view

    Dear Steven,

     

    We have a follow up question. Would it be possible to adjust the formula so that the button can only be clicked once per record? (For instance, that the button disappears after click or turns greyed out)

     

    Right now, if a user accidentaly clicks the button twice the multitext content will also be added twice to the subtable. This means that 4 borrowed books would mistakenly be registered as 8 books.

     

    Extremely thankful for your help!

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

    Hi, you can hide the button with a triggered yes/no field (ViewButton) whith the option required to yes and standard value to yes.

    This schould be added to the buttons code: ViewButton := False

    Now in the buttons preferences where you have show only when: ViewButton

    Steven.