![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table, tbl1, looking like this: Id * * Val 1 * * *a 2 * * *b 3 * * *c 4 * * *d and FM autocreated a default layout for it, also called "tbl1". I created a self-join relationship from Id to Id, calling the "shadow" table "tbl1a", and with the condition between Id and Id being "not equals". I created a layout showing fields from "tbl1a", calling the layout "tbl1a" I created the following script: Go to Layout ["tbl1" (tbl1)] Go to record/request/Page [First] Loop * Show Custom Dialog ["Outer loop"; tbl1::Id] * Go to Related Record [Show only related records; From table: "tbl1a"; Using layout: "tbl1a" (tbl1a)] * Go to Layout ["tbl1a" (tbl1a)] * Loop * * Show Custom Dialog ["Inner loop"; tbl1:.Id & ", " & tbl1a::Id] * * Go to Record/Request/Page [Next; Exit after last] * End Loop * Go to Layout ["tbl1" (tbl1)] * Go to Record/Request/Page [Next; Exit after last] End Loop I expect the following output from the invocations of Show Custom Dialog: Outer loop *1 Inner loop * 1, 2 Inner loop * 1, 3 Inner loop * 1, 4 Outer loop *2 Inner loop * 2, 1 Inner loop * 2, 3 Inner loop * 2, 4 Outer loop *3 Inner loop * 3, 1 Inner loop * 3, 2 Inner loop * 3, 4 Outer loop *4 Inner loop * 4, 1 Inner loop * 4, 2 Inner loop * 4, 3 But I see this output: Outer loop *1 Inner loop * 1, 2 Inner loop * 1, 3 Inner loop * 1, 4 Outer loop *2 Inner loop * 2, 1 Inner loop * 1, 3 Inner loop * 1, 4 Outer loop *3 Inner loop * 2, 1 Inner loop * 1, 2 Inner loop * 1, 4 Outer loop *4 Inner loop * 2, 1 Inner loop * 1, 2 Inner loop * 1, 3 Why do the values for tbl1::Id in the inner loop not match what I expect ? How come tbl1::Id in the outer loop doesn't match tbl1::Id in the inner loop ? |
#3
| |||
| |||
|
|
Go to Layout ["tbl1" (tbl1)] Go to record/request/Page [First] Loop Show Custom Dialog ["Outer loop"; tbl1::Id] Go to Related Record [Show only related records; From table: "tbl1a"; Using layout: "tbl1a" (tbl1a)] Go to Layout ["tbl1a" (tbl1a)] Loop Show Custom Dialog ["Inner loop"; tbl1:.Id& ", "& tbl1a::Id] Go to Record/Request/Page [Next; Exit after last] End Loop Go to Layout ["tbl1" (tbl1)] Go to Record/Request/Page [Next; Exit after last] End Loop |
#4
| |||
| |||
|
|
snip There are perhaps other ways to do it without switching layouts, as well. For example, you could loop through tbl1a records and then just grab the full list of related records with the list() function (and then loop through those variables to assemble data in the way you want). |
)
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I'm trying to _learn_ Filemaker. That is why it might be more valuable to me to try something, and have people explain to me why I'm doing it wrong (and as you'll see in the thread elsewhere, some people do get what I'm trying to do), than to simply receive a solution, which I might not understand fully. I'm not interested in http://en.wikipedia.org/wiki/Cargo_cult_programming :-) |
)![]() |
| Thread Tools | |
| Display Modes | |
| |