Script for Inventory

Hello everyone,

For information, I only speak French. So the following is translated by "google translate".

I start with NINOX.

I am busy developing a table allowing me to carry out inventories. I've almost finished everything, but for now, I'm stuck.

To begin with :
I need that when I press a "start inventory" button that ninox shows me all the items.
I have already planned everything, but I finally lack a script that launches the "automatic" selection of all the articles on the "Item Code". And there, I don't know how to write it.

Next :
I would like to be able to include a condition filter, which would allow the system to select only items belonging to a specific product family.
There also I planned a field allowing to select the various families. Missing more than the script.

Could someone help me?

Thanks in advance and have a nice day everyone



13replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Fred
    • Fred
    • 8 days ago
    • Reported - view
    Didier Schoonjans said:
    I have already planned everything, but I finally lack a script that launches the "automatic" selection of all the articles on the "Item Code".

     What do you mean by “automatic”?

    In your first picture, what is the code for the two, what I assume are, dynamic choice fields?

    Maybe you can post a sample DB?

  • Hello Fred,
    In my "Inventories" table I use a "List" sub-table.
    I have planned two possibilities to carry out the inventories.

    A first "Manual" where the user selects item after item in order to gradually fill his inventory (in this case, everything is finalized and is OK)

    A second "Automatic" where the user goes through a second filter in which he chooses if he wants all the articles or if he only wants a part of them selected according to the family of articles.

    Currently I have already created the dynamic family selection field. But I don't know how to make the system fetch the articles, sort them and then fill my "list" table

    I want to give you a copy of my DB, but how do I do it?

    I start under NINOX

    Thanks in advance


    • Fred
    • Fred
    • 7 days ago
    • Reported - view
    Didier Schoonjans said:
    I want to give you a copy of my DB, but how do I do it?

     If you are using the App with a local/iCloud DB then click on the upper right of the DB icon and select Save archive as..

    If you are using a browser then you have to have the Professional level to save a manual backup.

    If you have a cloud based DB, you can use the App to export the whole DB as a ninox file.

    1. Open the DB
    2. Select the DB name from the left side
    3. Click on the Export data button
    4. Select Ninox as the option
    5. Type an appropriate name and save

    Then make a new response then click on the paper clip icon above the Reply button.

    • Fred 

      Hello Fred,
      Thank you for your reply,
      I use a "starter" version for 1 user via Browser.
      I contacted Ninox support, to see with them what they can do to help me create a copy of my DB.
      I will come back to you as soon as I have an answer from them.
      Have a good day

    • Fred 

      NINOX support tells me that I can simply invite you to my database.
      For this I need your e-mail address which must be linked to a NINOX subscription.
      If you want to give it to me outside of this thread here is mine.

    • Fred
    • Fred
    • 7 days ago
    • Reported - view

    1) How do you want Families Produit to be filtered by Type de selection? Families Produit is a dynamic multi choice (dMC) field pointing to Families_Produit table. The Families_Produit table is a child table of Parametres. Neither table has a field that has data that matches the choices in Type de selection.

  • In the "articles" table, I classify the different "article" by families.
    The purpose of the "Product_Families" table is to allow the use of a filter during inventories to select:
      - either all the articles
      - or only those belonging to a particular product family.

    In the "Inventories" table I use a multiple-choice table a bit out of obligation, because I found a script allowing me to choose such and such a family that I adapted. It works exactly as I wanted, but I don't like the multiple choice soltion, I would have preferred a classic dynamic field (like in the "Articles" table).

  • hello fred

    I found to replace the "dynamic multiple field" by a "single choice dynamic field" and adapt my formula.
    However, I still haven't figured out how to fill in the table.
    it going :)

    • Fred
    • Fred
    • 5 days ago
    • Reported - view

    Take a look at the changes I made in the DB.

    I made a new button and put this for the onClick:

    let t := this;
    let xSel := record(Familles_Produit,number('Familles Produit'));
    if 'Familles Produit' != null then
        do as server
            let xArt := (select Articles where 'Familles Produit' = t.'Familles Produit');
            for loop1 in xArt do
                let newRec := (create Listes);
                    Inventaires := t;
                    Articles := loop1
        alert("Please select a family")

    Line 1 gets the data of the current record in the Inventaires table.

    Line 2 is probably not needed.

    Lines 3-16 is where the code first checks that the 'Familles Produit' field is not empty. If this is true then it will, on the server (line 4),

    1) select all records (line 5) in the Articles table where 'Familles Produit' equals the 'Familles Produit' in the current record.

    2) line 6, starts a for loop that takes the results from line 5 and for each instance it will create a record in Listes (line 7) and then link the two reference fields to the appropriate tables (lines 9 and 10).

    3) if line 3 returns a false then it gives an alert.

    I also removed the Display field only, if: for Listing (ajout), so you can see the added records to the Listes table.

  • Thank you very much Fred.
    What a nice surprise to connect to my DataBase this morning and find a red button in my Inventory table.
    You did what I originally wanted to do. Thank you so much.

    Initially I thought to launch an inventory of all items.
    Then I said to myself that having the possibility of making a partial inventory by type of "Product Family" would be a plus. Hence the fact of having added the filter.

    What you have done is the possibility of making inventories by families (which seemed to me to be the most complicated).
    Now I guess it is enough to replace the message    [  alert("Please select a family")  ]    by a loop that displays all the articles?

    Thanks again

    • Fred
    • Fred
    • 4 days ago
    • Reported - view
    Didier Schoonjans said:
    Now I guess it is enough to replace the message    [  alert("Please select a family")  ]    by a loop that displays all the articles?

     You can do that. Do you need help with the loop? You can check out my response in a post for ideas.

  • Hello Fred,
    I'll try to manage on my own (it's the only way to learn), if I don't, I'll come back to you.
    And thank you again for your help.


    Like 1
  • Hello Fred,
    Well, I think I managed to figure it out. Anyway, everything is working fine.

    Do not hesitate to criticize me if it is possible to make the code simpler

    I adapted your code to get by.
    Part.1 (lines 1 to 3) Selection of "Manual" or "Automatic" modes
    Part.2 (lines 4 to 16) Your code to display articles by "Product Family"
    Part.3 (lines 17 to 22) Display of the warning message that no "Product families" have been selected
    Part.4 (lines 23 to 34) Display of all articles
    Part.5 (line 35) condition if you change your mind and finally want to select a family


    Now I have two more things to do:
    1) It is to add a new filter with the possibility of selecting or not the articles "not managed in stock"
    2) ensure that once the inventory has reached status 3 (closed inventory) that the stock of items changes.

Like Follow
  • 5 hrs agoLast active
  • 13Replies
  • 147Views
  • 2 Following