![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
i have a script step for 'go to related record'. I would like to capture the case when there is *no* related record, and prompt for the creation of a *new* record in the related table. does anyone know the error code, or how to script this? in pseudo code, something like: go to related record from table x using layout y, show only related records if no related records then go to layout y, create new record end if |
#3
| |||
| |||
|
|
hello all and happy 2007! i have a script step for 'go to related record'. I would like to capture the case when there is *no* related record, and prompt for the creation of a *new* record in the related table. does anyone know the error code, or how to script this? in pseudo code, something like: go to related record from table x using layout y, show only related records if no related records then go to layout y, create new record end if thoughts? |
#4
| |||
| |||
|
|
I use this a lot. Not sure what the script steps and functions are called in your version, this is my translation from my German version: Enter Browse mode If IsValid(y::somefield) Go to related records (Y, Laoyut Y) Else grab key field go to layout y New record set key field end if |
#5
| |||
| |||
|
|
In article <1hrdxgl.uj3wsob8o4jkN%clk (AT) freesurf (DOT) ch>, clk (AT) freesurf (DOT) ch (Christoph Kaufmann) wrote: I use this a lot. Not sure what the script steps and functions are called in your version, this is my translation from my German version: Enter Browse mode If IsValid(y::somefield) Go to related records (Y, Laoyut Y) Else grab key field go to layout y New record set key field end if I, too, use IsValid for this purpose and many other reasons to learn if any related records exist or not (I'm running FM 6, served, with multi-platform clients). Long ago I ran across someone complainging that the IsVald script step was unstable. This has worried me ever since, but I've never found a circumstance where it would fail me. What *has* failed me is using variations of Helpful Harry's IsEmpty(relationship::related field). For some kind of finds & script analysis, if a record does not exist, then the field is not empty, it's just not there. Steve Brown |
#6
| |||
| |||
|
|
In article <1hrdxgl.uj3wsob8o4jkN%clk (AT) freesurf (DOT) ch>, clk (AT) freesurf (DOT) ch (Christoph Kaufmann) wrote: I use this a lot. Not sure what the script steps and functions are called in your version, this is my translation from my German version: Enter Browse mode If IsValid(y::somefield) Go to related records (Y, Laoyut Y) Else grab key field go to layout y New record set key field end if I, too, use IsValid for this purpose and many other reasons to learn if any related records exist or not (I'm running FM 6, served, with multi-platform clients). Long ago I ran across someone complainging that the IsVald script step was unstable. This has worried me ever since, but I've never found a circumstance where it would fail me. What *has* failed me is using variations of Helpful Harry's IsEmpty(relationship::related field). For some kind of finds & script analysis, if a record does not exist, then the field is not empty, it's just not there. |
#7
| |||
| |||
|
|
BUT, there are other ways. Usually I use the Count function. If there are no related records then counting them will add up to 0. ie. If Count(Relation::KeyField) = 0 Message "There are no Related records" Else Message "There are Count(Relation::KeyField) related records" |
#8
| |||
| |||
|
|
Create a calc field something like CompareKeys = If ( ThisTable::ThisKey = ThatTable::ThatKey ; 1 ; 0 ) Then look at the value of CompareKeys to determine if a related record exists. |
![]() |
| Thread Tools | |
| Display Modes | |
| |