Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.filemaker > #2060 > unrolled thread
| Started by | csampson@inetworld.net (Charles H. Sampson) |
|---|---|
| First post | 2015-03-09 15:40 -0700 |
| Last post | 2015-03-10 11:30 -0700 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.databases.filemaker
Processing Portal Data in a Script csampson@inetworld.net (Charles H. Sampson) - 2015-03-09 15:40 -0700
Re: Processing Portal Data in a Script Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-10 13:13 +1300
Re: Processing Portal Data in a Script csampson@inetworld.net (Charles H. Sampson) - 2015-03-12 10:39 -0700
Re: Processing Portal Data in a Script Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-03-13 16:32 +1300
Re: Processing Portal Data in a Script Howard Schlossberg <howard@nospam.fmprosolutions.com> - 2015-03-12 20:58 -0700
Re: Processing Portal Data in a Script clkaufmann@gmx.ch (Christoph Kaufmann) - 2015-03-10 07:42 +0100
Re: Processing Portal Data in a Script Howard Schlossberg <howard@nospam.fmprosolutions.com> - 2015-03-10 11:30 -0700
| From | csampson@inetworld.net (Charles H. Sampson) |
|---|---|
| Date | 2015-03-09 15:40 -0700 |
| Subject | Processing Portal Data in a Script |
| Message-ID | <1m10vq4.1wio5y81i39lq2N%csampson@inetworld.net> |
What is the process for processing data from a portal in a script when
there's the possibility that there are no linked records? I'm using Go
To Portal Row (First) and then asking if I'm at row 0. If I'm not, then
I loop through the portal rows using Go To Record/Request/Page (Next)
with Exit On Last. Things aren't working so using some carefully placed
Show Custom Dialogs I find that I am indeed at portal row 0 when I enter
the loop if the portal does have linked records. Here's a fragment to
try to make that clear.
Go to Layout ["Layout With Portal"; Main Data]
Go to Record/Request/Page [First]
If [Get (PortalRowNumber) /= 0]
# Here's where my Custom Dialog with Get (PortalRowNumber) goes.
# It shows that the row number is 0 if there are portal rows.
Loop
... Stuff that might take me away from Layout With Portal.
Go to Layout ["Layout With Portal"; Main Data]
Go to Portal Row [Next; Exit after last]
End Loop
End If
Please forgive any typos. While waiting for responses, I'll be looking
for pilot error.
I'm still using FMP8. My ancient desktop is showing signs of age and I'm
frantically converting old databases from Reflex Plus to FMP before it
completely dies and I have to move to a new machine.
Charlie
--
Nobody in this country got rich on his own. You built a factory--good.
But you moved your goods on roads we all paid for. You hired workers we
all paid to educate. So keep a big hunk of the money from your factory.
But take a hunk and pay it forward. Elizabeth Warren (paraphrased)
[toc] | [next] | [standalone]
| From | Helpful Harry <HelpfulHarry@BusyWorking.com> |
|---|---|
| Date | 2015-03-10 13:13 +1300 |
| Message-ID | <100320151313514318%HelpfulHarry@BusyWorking.com> |
| In reply to | #2060 |
In article <1m10vq4.1wio5y81i39lq2N%csampson@inetworld.net>, Charles H.
Sampson <csampson@inetworld.net> wrote:
> What is the process for processing data from a portal in a script when
> there's the possibility that there are no linked records? I'm using Go
> To Portal Row (First) and then asking if I'm at row 0. If I'm not, then
> I loop through the portal rows using Go To Record/Request/Page (Next)
> with Exit On Last. Things aren't working so using some carefully placed
> Show Custom Dialogs I find that I am indeed at portal row 0 when I enter
> the loop if the portal does have linked records. Here's a fragment to
> try to make that clear.
>
> Go to Layout ["Layout With Portal"; Main Data]
> Go to Record/Request/Page [First]
> If [Get (PortalRowNumber) /= 0]
> # Here's where my Custom Dialog with Get (PortalRowNumber) goes.
> # It shows that the row number is 0 if there are portal rows.
> Loop
> ... Stuff that might take me away from Layout With Portal.
> Go to Layout ["Layout With Portal"; Main Data]
> Go to Portal Row [Next; Exit after last]
> End Loop
> End If
>
> Please forgive any typos. While waiting for responses, I'll be looking
> for pilot error.
>
> I'm still using FMP8. My ancient desktop is showing signs of age and I'm
> frantically converting old databases from Reflex Plus to FMP before it
> completely dies and I have to move to a new machine.
I'm guessing that "/=" is simply your way of retyping "not equal"
within the confines of the text-based Newsgroups since it won't work in
FileMaker itself. (You can use "<>" instead, which also works in
FileMaker.)
There are various ways to test if there are not any related records:
- Count(Relationship::KeyField) = 0
- Relationship::KeyField = ""
- IsEmpty(Relationship::KeyField)
It's probably best to use a Portal is set to NOT allow creation of
related records, otherwise going to the Portal may create a related
record. You could instead use any related field that you know cannot be
empty for real related record.
If you leave the Layout with the Portal, then FileMaker may exit the
Portal and lose track of where it was. Depending on what you're doing,
it may be better to run the script in the Related file / table itself
by first going to that and finding / showing only the related records.
As a side note, if you've got more than one Portal on the Layout, then
you need to make sure you're in the correct Portal - usually that's
easiest done by going to the Relationship::FieldInPortal
Helpful Harry :o)
[toc] | [prev] | [next] | [standalone]
| From | csampson@inetworld.net (Charles H. Sampson) |
|---|---|
| Date | 2015-03-12 10:39 -0700 |
| Message-ID | <1m162nd.1ls1qm81cmdqygN%csampson@inetworld.net> |
| In reply to | #2061 |
Helpful Harry <HelpfulHarry@BusyWorking.com> wrote: > In article <1m10vq4.1wio5y81i39lq2N%csampson@inetworld.net>, Charles H. > Sampson <csampson@inetworld.net> wrote: > > > What is the process for processing data from a portal in a script when > > there's the possibility that there are no linked records? I'm using Go > > To Portal Row (First) and then asking if I'm at row 0. If I'm not, then > > I loop through the portal rows using Go To Record/Request/Page (Next) > > with Exit On Last. Things aren't working so using some carefully placed > > Show Custom Dialogs I find that I am indeed at portal row 0 when I enter > > the loop if the portal does have linked records. Here's a fragment to > > try to make that clear. > > > > Go to Layout ["Layout With Portal"; Main Data] > > Go to Record/Request/Page [First] > > If [Get (PortalRowNumber) /= 0] > > # Here's where my Custom Dialog with Get (PortalRowNumber) goes. > > # It shows that the row number is 0 if there are portal rows. > > Loop > > ... Stuff that might take me away from Layout With Portal. > > Go to Layout ["Layout With Portal"; Main Data] > > Go to Portal Row [Next; Exit after last] > > End Loop > > End If > > > > Please forgive any typos. While waiting for responses, I'll be looking > > for pilot error. > > > > I'm still using FMP8. My ancient desktop is showing signs of age and I'm > > frantically converting old databases from Reflex Plus to FMP before it > > completely dies and I have to move to a new machine. > > I'm guessing that "/=" is simply your way of retyping "not equal" > within the confines of the text-based Newsgroups since it won't work in > FileMaker itself. (You can use "<>" instead, which also works in > FileMaker.) You're right about /=. I meant to explain it and forgot. would have used <> if I had remembered it and avoided all confusion. > There are various ways to test if there are not any related records: > > - Count(Relationship::KeyField) = 0 > > - Relationship::KeyField = "" > > - IsEmpty(Relationship::KeyField) > ... Several people have used the construct Relationship::Field in replies. As well as I can tell, relationships aren't named in FMP8. Is this something that came along later or do you all mean TableName::Field? As usual, thanks for your help, Harry. Charlie -- Nobody in this country got rich on his own. You built a factory--good. But you moved your goods on roads we all paid for. You hired workers we all paid to educate. So keep a big hunk of the money from your factory. But take a hunk and pay it forward. Elizabeth Warren (paraphrased)
[toc] | [prev] | [next] | [standalone]
| From | Helpful Harry <HelpfulHarry@BusyWorking.com> |
|---|---|
| Date | 2015-03-13 16:32 +1300 |
| Message-ID | <130320151632095108%HelpfulHarry@BusyWorking.com> |
| In reply to | #2089 |
In article <1m162nd.1ls1qm81cmdqygN%csampson@inetworld.net>, Charles H. Sampson <csampson@inetworld.net> wrote: > Helpful Harry <HelpfulHarry@BusyWorking.com> wrote: > > In article <1m10vq4.1wio5y81i39lq2N%csampson@inetworld.net>, Charles H. > > Sampson <csampson@inetworld.net> wrote: > > > > > > What is the process for processing data from a portal in a script when > > > there's the possibility that there are no linked records? I'm using Go > > > To Portal Row (First) and then asking if I'm at row 0. If I'm not, then > > > I loop through the portal rows using Go To Record/Request/Page (Next) > > > with Exit On Last. Things aren't working so using some carefully placed > > > Show Custom Dialogs I find that I am indeed at portal row 0 when I enter > > > the loop if the portal does have linked records. Here's a fragment to > > > try to make that clear. > > > > > > Go to Layout ["Layout With Portal"; Main Data] > > > Go to Record/Request/Page [First] > > > If [Get (PortalRowNumber) /= 0] > > > # Here's where my Custom Dialog with Get (PortalRowNumber) goes. > > > # It shows that the row number is 0 if there are portal rows. > > > Loop > > > ... Stuff that might take me away from Layout With Portal. > > > Go to Layout ["Layout With Portal"; Main Data] > > > Go to Portal Row [Next; Exit after last] > > > End Loop > > > End If > > > > > > Please forgive any typos. While waiting for responses, I'll be looking > > > for pilot error. > > > > > > I'm still using FMP8. My ancient desktop is showing signs of age and I'm > > > frantically converting old databases from Reflex Plus to FMP before it > > > completely dies and I have to move to a new machine. > > > > I'm guessing that "/=" is simply your way of retyping "not equal" > > within the confines of the text-based Newsgroups since it won't work in > > FileMaker itself. (You can use "<>" instead, which also works in > > FileMaker.) > > You're right about /=. I meant to explain it and forgot. would have used > <> if I had remembered it and avoided all confusion. > > > There are various ways to test if there are not any related records: > > > > - Count(Relationship::KeyField) = 0 > > > > - Relationship::KeyField = "" > > > > - IsEmpty(Relationship::KeyField) > > ... > > Several people have used the construct Relationship::Field in replies. > As well as I can tell, relationships aren't named in FMP8. Is this > something that came along later or do you all mean TableName::Field? > > As usual, thanks for your help, Harry. Sorry, I don't know what newer versions of FileMaker do / don't do ... I'm still using mostly version 5.5. It shouldn't matter since you don't have to type it in. It's really just an easy way of saying to use the related record's KeyField via the Relationship. When using a create calculation window there is a list of field names in the window, and above that is a pop-up menu which in older versions of FileMaker lists the relationships - it should be the same process in newer versions. When you change the pop-up menu, the related table's fields are listed instead. It's similar to putting fields into the Portal on a Layout. Helpful Harry :o)
[toc] | [prev] | [next] | [standalone]
| From | Howard Schlossberg <howard@nospam.fmprosolutions.com> |
|---|---|
| Date | 2015-03-12 20:58 -0700 |
| Message-ID | <mdtn6u$45i$4@news.motzarella.org> |
| In reply to | #2089 |
On 3/12/2015 10:39 AM, Charles H. Sampson wrote: > Several people have used the construct Relationship::Field in replies. > As well as I can tell, relationships aren't named in FMP8. Is this > something that came along later or do you all mean TableName::Field? Sorry, yes. It is actually TableName::Field. Or technically, it is really TableOccurence::Field
[toc] | [prev] | [next] | [standalone]
| From | clkaufmann@gmx.ch (Christoph Kaufmann) |
|---|---|
| Date | 2015-03-10 07:42 +0100 |
| Message-ID | <1m124zb.igsqvh1i8n1o2N%clkaufmann@gmx.ch> |
| In reply to | #2060 |
Charles H. Sampson <csampson@inetworld.net> wrote: [FMP 8] > What is the process for processing data from a portal in a script when > there's the possibility that there are no linked records? Don't bother with the portal. It shows related records, you can use the relation you've set up. The function count ( releation::foreignKey ) tells you how many child records the current record has - this is the number of records the portal shows. If the count results in something > 0, use the script step Go to related records if you need to do anything with the child records. -- Christoph Kaufmann http://clk.ch
[toc] | [prev] | [next] | [standalone]
| From | Howard Schlossberg <howard@nospam.fmprosolutions.com> |
|---|---|
| Date | 2015-03-10 11:30 -0700 |
| Message-ID | <mdnd64$93d$3@news.motzarella.org> |
| In reply to | #2063 |
I agree with Christoph to NOT loop through the portal. It is much better form to go to the related set of records and loop through those, rather than relying on the UI of the portal. However, instead of using the count() function as a test (which you must do before attempting to go to related records), I would test for "not isempty( relation::foreignKey )". The benefit of that over count() is that the calc then only has to be sure there is a minimum of ONE related record as opposed to having to count ALL related records. This isn't a big difference for just a handful of records, but becomes much more of an issue if there might be dozens or hundreds of related records. Howard On 3/9/2015 11:42 PM, Christoph Kaufmann wrote: > Charles H. Sampson <csampson@inetworld.net> wrote: > > [FMP 8] >> What is the process for processing data from a portal in a script when >> there's the possibility that there are no linked records? > > Don't bother with the portal. It shows related records, you can use the > relation you've set up. > > The function count ( releation::foreignKey ) tells you how many child > records the current record has - this is the number of records the > portal shows. > > If the count results in something > 0, use the script step Go to related > records if you need to do anything with the child records. >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.filemaker
csiph-web