Need to link each expense from this week to a record and then link it to the main table
Hello!
I have in this issue, three tables:
1st Table: Management (for each week there is a record.
2nd Table: Fixe Ausgaben (every record is one expense, which is recurring monthly on a specific date.)
3rd Table: Zwischentabelle für fixe Ausgaben (it links to the 2nd Table (Fixe Ausgaben) and the first Table (Management)
I want to have a loop which makes all this job for me.
So the loop is already doing all fine, except one thing:
It doesnt link each record from the array to his record in the table Nr. 3
The loop does fine:
Creates from the number of records of the array new records in the 3rd Table and links them to the record in the 1st table.
I also attach my database here:
Test.ninox
7 replies
-
You need to reference your for loop variable in the loop.
for fixeAusgabenTabelle in ExpenseThisWeek do let thisExpense := this.ExpenseThisWeek; let newRec := (create 'Zwischentabelle für fixe Ausgaben'); let thisExpense := this; newRec.( 'Fixe Ausgaben' := fixeAusgabenTabelle; Management := t ) end
I would recommend that you change the for loop variable fixeAusgabenTabelle as you use it earlier in your code for another set of data. Maybe something like:
for loop1 in ExpenseThisWeek do let thisExpense := this.ExpenseThisWeek; let newRec := (create 'Zwischentabelle für fixe Ausgaben'); let thisExpense := this; newRec.( 'Fixe Ausgaben' := loop1; Management := t ) end
so you can easily see which loop variable you are using. This comes in handy when you have loops inside of loops inside of loops. Yeah, don't ask.
Here is what I get:
Content aside
- Status Answered
- 5 mths agoLast active
- 7Replies
- 32Views
-
2
Following