Displaying a record in another table
Hello
There is table 1 in which there is table 2, record there are made using the button. 'tab.name' - 'number' - 'group'
In table 3 there is an sub table 5. And I need that if the date in table 1 and in table 3 same, then the record from the fields 'tab.name' - 'number' - 'group' goes to table 5 in the field 'tab.name' - 'number' - 'group'
now the system is set up so that I need to enter the same data in table 5 p in fields 'tab.name' - 'number' - 'group' and the rest will go automatically. That's why I need the record to be automatically displayed in this field, the system will do the rest by itself
18 replies
-
said:
now the system is set up so that I need to enter the same data in table 5 p in fields 'tab.name' - 'number' - 'group' and the rest will go automatically. That's why I need the record to be automatically displayed in this field, the system will do the rest by itselfI don't quite understand what you are saying here?
Are you trying to show related records from Table5 in Table1 where the Date in Table3 equals the Date in Table1?
Then you want to change the button on Table1 to create records in Table5 as well as related records in Table3 and Table4?
-
said:
in table2 there are records. And if in table3 I create a day, and on this day in table2 there is a record, it should be displayed in table5
I need to work with tables, no viewThanks for a more detailed description.
Since Table2 and Table3/Table5 are not related then you need to use a view element to show Table2 in Table5.
This is where using data in related records can be hard to see and thus hard to imagine the coding. To make things easier, I would recommend creating a formula field in both Table2 and Table5 that points to the related Date in Table1 and Table3. One it makes it more obvious what field you can search/filter on. Plus you don't have to follow the chain up everytime you want to use Date.
Then in a view element it is:
let t := this; select Table2 where Date = t.Date.
-
said:
I created a new field, I thought to add a button, but it creates a record, but when I open a new day, it is empty.I'm looking at the new DB you uploaded and I can't find any other button besides the one in Table1.
said:
I think that is necessary to make it so that, when ia new day is created in table5, it should create the same record from table2, separetly each one, where the values of several fields will be copiedNow that my slow brain has caught up a bit here is a question:
Will Table5 store different data than Table2? If not then why not link Table4 to Table2?
If you want to duplicate Table2 to Table5, then my question still holds how will you do it? Through a button? and on which table?
I'm heading out for a few hours. If no one else responds I'll see where you are at when I get back.
-
said:
let d := format(Date, "DD.MM.YY"); (select 'Table2')[format(Date, "DD.MM.YY") = d].number
if ш use this formula, having previously created the 'Date' fields, then in the field it takes data from all the fields from table 2, there are three records. How to make it so that all the records from table 2 are created separately in table 5? I need to solve this issueWhen you are trying to find a set of records that you need to then do something with each record individually, then you need to:
- create an array of the record Ids
- use the for loop
So to do step 1, you could do something like:
let d := Date; let recsToDuplicate := (select 'Table2' where Date = d)
You don't need to format the Date field since you are not displaying it.
In line 2, I put the results of the select into a variable and I removed the square brackets [ ]. Why, because when you use a square bracket in a select you are telling Ninox to send over the entire table to your computer and then your computer will filter the results. Not something you want to do if your table has 1,000 or 10s of thousands of records. Always start with the where, but there could be moments where you need square brackets with a select statements.
Now that we have an array, in the variable recsToDuplicate, to work with we can add a for loop to cycle through the array and do something with each record.
let d := Date; let recsToDuplicate := (select 'Table2' where Date = d); for record in recsToDuplicate do let newRec := create Table5; newRec.( 'Tab. Name' := record.'Tab. Name'; Number := record.Number; Group := record.Group ) end
But there is a link that is not created, the link between Table4 and Table5. Why don't you give it a try on how to create that link. You will need to:
- find the appropriate record in Table4 and put it in a variable
- modify the newRec.() part of the code to use the variable from step 1 to make the link
- you will need the first() command as well
-
Are GM TABLE records differentiated by Date? So there is only 1 record in GM TABLE for each day?
Your Daily Estimation table seems a bit redundant if your GM TABLE is also daily. This could make your Hourly Estimation table a sub table of GM TABLE. You would have to switch the reference direction. You have the reference (1:N) from Hourly to GM TABLE which is backwards. It should be many Hourly to one GM. So you would create the reference field in Hourly Estimations to GM TABLE.
It seems like you would also need number fields to store what you had on hand at that hour instead of formula fields as that would change as your numbers change.
-
Take a look at the attached DB.
It will open to a dashboard. You can play around with the selecting a GM TABLE record then a table record then you can click on Create Hourly Estimate and see that it creates an hourly estimate of the table you selected.
The other button to create a table doesn't do anything.
-
said:
always create hourly estimates for all tables?Every day, every hour
said:
do you want the ability to select the tables you want to create hourly estimates for?
yes, I click on the table I need and do it estimation
said:
I moved the Hourly Estimation table to under GM TABLES. Plus the button doesn't link Daily Estimations to GM TABLES so that is why nothing shows up in the dynamic choice field.The one, who does the estimation, does not have acess to rigts to GM Table
-
said:
Do you want Daily Estimations linked to GM TABLES? You have it setup to be N:1 from Daily Estimations to GM TABLES. It would work better if it was switched, unless you plan on having multiple GM TABLES connected to 1 Daily Estimation.information about created tables is sent from the GM table, and information from other tables is collected in this table for viewing.
Content aside
- 4 mths agoLast active
- 18Replies
- 98Views
-
2
Following