0

Parent and Child reUnion

I currently have a need to create a UNION between some Parent and Child records. The fields I want to use are mappable between the 2 tables, so the resulting selections can match.

In fact I have each selection in their own formula field for convenience, so array(children,parents) as the basis of a View field produces a list with the correct number of records (2 parents and 7 children), but although I can easily edit fields to show in the View, only data for the children is actually shown. I cannot get any parent field data to appear in the View - except one field.

These are actually motorcycles and both tables have fields for image, Make, Model and Name, named the same in both tables, but only the Name column in the View shows the data for all records. No matter how I try to select the appropriate field for the parent record, it remains blank - except the Name column which has data from both tables, i.e. for all records and which means using the same fieldname in both tables cannot be the problem.

To clarify, no these table cannot be merged, they are different actual data items. The parent is the model type and children are actual vehicles. I'm trying to view selected vehicles (children) plus some Models (parents) that have no children (vehicles), so no relationships involved between any of the selected records.

In the meantime I simply have 2 Views on the Form, one for the children and one for the parents, but I'd prefer to show all the data in a single View.

Any suggestions?

6 replies

null
    • Fred
    • 8 days ago
    • Reported - view

    If you are trying to make a new table that is a mix of the parent and child tables then you have to make a new JSON table or actually make a new table.

    View elements can only take data from one table at a time, so if you want to mix tables then you will have to make use of HTML tables and JSON.

    If you post a sample DB, we can help you out.

      • John_Halls
      • 8 days ago
      • Reported - view

       Not so. Have a look at this example. Two different tables with the same structure. The View code is

      let a := (select A);
      let b := (select B);
      let c := array(a, b);
      c
      

      It even goes to the correct record, either from Table A or Table B, when clicking in a row.

      Regards John

      • Fred
      • 7 days ago
      • Reported - view

       Well what do you know, even for tables that don't match fields it works. I don't know how Ninox decides what fields to show or where to put data if the fields don't match but it does.

      • John_Halls
      • 7 days ago
      • Reported - view

       I doubt it's a feature as such, so use with caution.

      • UKenGB
      • 6 days ago
      • Reported - view

       Yes, that's what I tried, but AFAICT, it's impossible to successfully control which fields can be displayed from both tables.

      • Fred
      • 6 days ago
      • Reported - view

       That is why you will have to use an html table and json.

Content aside

  • 6 days agoLast active
  • 6Replies
  • 51Views
  • 4 Following