Pulling data from table D and E based on table C which I choose based on table B That I select in table A

Tabidoo seems like a really powerful tool, but sadly, I have 0 experience in javascript, I only did some work in uni with relation databases which I could simply nest together, but I found that in Tabidoo, the linked tables dont get transferred when you continue linking :confused:

So, first of all. I am sharing a diagram of my application.

My aim: Start up table fakturace choose a user from table “Osobní údaje”
That will filter out table “Opravované zařízení” to only show records that have the user ID associated.
And when I choose a device in “Opravované zařízení” It will automatically pull data from tables “Fakturovatelné úkony” and “Náhradní díly” to then start report in “fakturace”

What I thought of so far-
load the form and manually select a customer from table “Osobní údaje”
Get ID of that customer and filter out table “Opravované zařízení” Which will let me choose what device from the customer I want to select. Based on selecting the device ID, select records from table “Fakturovatelné úkony” and “Náhradní díly”

JS is where I am loosing it. I have no idea how to select object parameter in filtering table :confused:

My code snippet and resulting output in console:

    let zakaznik_id = await doo.model.zakaznik.value.id;
        console.log(zakaznik_id); //confirms that I have selected a proper ID
    let load_zarizeni = await doo.table.getData("opravovanazarizeni");
    console.log(load_zarizeni);


I can see, that the customer ID is being selected properly, But I cant find a way to filter out the table “opravovanazarizeni” to only select records containing user ID.

Any suggestions/tips/tricks would be gladly appreciated.

Hi,

take a look at our documentation, where you can also find examples of how to properly filter records via getData.

With Regards,

Filip

Hi,
yes, filtering via getdata is working, but I only have it loaded in JS but not in the linked table.
By default, ONE fakturace to MANY doesnt show any records in table fakturace to choose/filter from

I was able to create a workaround for this over the weekend with linking MANY fakturace to MANY, which lets me manually choose the records.

I tried to filter the doo.model based on values from getdata, but it threw an error after I was filtering array inside of an object in object and I just scrapped it as a non-viable solution, especially when I dont want to be able to link MANY to MANY.

Here is my code snippet, that properly loads up records via getdata in tables fakturovatelneukony and nahradni dily based on my requirements

    let zakaznik_id = await doo.model.zakaznik.value.id; // Proměnná, kde se vytáhne ID z přiřazeného zákazníka
        //console.log(zakaznik_id);
   
    doo.model.zarizeni.filterForDropdown = "zakaznik.id === " + zakaznik_id; //Filtrování zařízení podle vybraného uživatele 
   
    let zarizeni_SN = await doo.model.zarizeni.value.SN._$$list; //Vytáhnutí sériových čísel zařízení, které jsou přiřazeny k zákazníkovi
        //console.log(zarizeni_SN);
    
    let pepik= await doo.table.getData("nahradnidily",
    {
        filter:"zarizeni.SN(eq)"+ zarizeni_SN
    } 
    );
  let pepik2= await doo.table.getData("fakturovatelneukony",
    {
        filter:"zarizeni.SN(eq)"+ zarizeni_SN
    } 
    );
       console.log(pepik);
       console.log(pepik2);

So now I have data in variables and dont know how to operate with them :smile:

I now need to update the linked table in fakturace based on this filtered out data I have. Could you please suggest anything? Because I am lost.

Hi, can you maybe try to say, what are trying to accomplish in general, then individual steps? I will try to help you and if that doesn’t work, I can offer you quick 10 minute free consultation.

Thank you,

Pavel Pančocha
Tabidoo Partner

Hi, yes ofcourse.

The aim- create a solution for our repair business, where we can easily manage all our repairs and invoices with data logging/tracking for every single step in the chain.

Customer comes in shop with a device and wants it repaired my idea was to create a simple tree hierarchy database for all of the information.

First branch will be Customer data- table B
Here we will log all the customer information and create a unique ID for each customer

The only branch from root is Devices-Tab C
Here we will assign devices to the user based on his ID and log basic info about the device.
Linked to table B with ONE customer to MANY devices

Now, Branching from tab C replacement parts - tab D and invoicable actions- tab E Which are asigned to a device based on its unique ID.
linked to table C is ONE device to MANY replacement parts and ONE device to MANY invoicable actions

Invoicing Table A is the last table in chain, but it acts as a root of all the tables, Its a table where we fill out rest of the data, such as due date, payment method and pickup options and most importantly, link all the data together. It is linked to table B with MANY fakturace to ONE customer

You just select a customer you want to invoice. From there, it would automatically filter out all of the devices user has submited for repair, of wich you choose a specific device, or devices, which were worked on. Based on this chain of inputs, everything important from table D and E should fill in to table A automatically.

This is what I had in mind when designing this system.

Currently, as stated above, I am able to Getdata from tables D and E, but I lack the knowledge to fill them in table A. Ofcourse the code I have in now only works when you first select a customer, save reload, select device, save reload, and then it gets the important data. The statements for that to work on change and only if customer and devices are present is easy and I will get to it later. I am struggling with the last part now.
Filtering users and devices is easy with module, but replacement parts and invoicable actions is where I struggle…

I will add you as a user to our application, so you have a look around and understand it better. I will gladly appreciate any input on this, as it seems that this is a quite unique issue, that hasnt been discussed on here before.

If anyone is interested in the solution to the problem:
What’s it about: We have products to be repaired, which have assigned spare parts and billable services.

Now we want to issue an invoice where we select the customer and the repaired products (there can be multiple). Now we need to include all the spare parts and services (from multiple products) in the invoice items.

The best solution is to perform the assignment in the background using a script (for example, in a workflow) after saving the record. The spare parts and services are not manually editable on the invoice but are handled entirely through the script.

Hi, I was using getdata do begin with, but yeah maybe I wasnt clear with my request.

So i will try again, disregarding the background about my application, because that seems to confuse everyone.

I want to get a specific value- DEVICE ID (recordID) with a getdata request, is there a way to do it?
This is a snippet of code that filters out a specific record in a table. I now need to get data[].fields.zakaznik.id from it

    let zakaznik_id = await doo.model.zakaznik.value.id; // Proměnná, kde se vytáhne ID z přiřazeného zákazníka
        console.log(zakaznik_id);

    let pepik= await doo.table.getData("opravovanazarizeni",
        {
            filter:"zakaznik.id(eq)"+ zakaznik_id
        } 
    );