dbTalk Databases Forums  

how to list the layouts with portals

comp.databases.filemaker comp.databases.filemaker


Discuss how to list the layouts with portals in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
George Lewycky
 
Posts: n/a

Default how to list the layouts with portals - 12-02-2009 , 04:49 PM






Hi I'm using FM5/Windows and we are converting to SQL Server.
I have 200+ layouts most of which are customer letters.

I'm trying find how to list all the layouts with a specific portal
field with a maximum of 5 rows.

Any ideas ?? Even having to list all the layouts to find the portal
field would be a real help

Thanks

George
george.lewycky (AT) nyct (DOT) com

Reply With Quote
  #2  
Old   
105
 
Posts: n/a

Default Re: how to list the layouts with portals - 12-07-2009 , 04:46 AM






George Lewycky wrote:
Quote:
Hi I'm using FM5/Windows and we are converting to SQL Server.
I have 200+ layouts most of which are customer letters.

I'm trying find how to list all the layouts with a specific portal
field with a maximum of 5 rows.

Any ideas ?? Even having to list all the layouts to find the portal
field would be a real help


This may not be relevant to FM5 George (too distant a memory), but in
later versions:

Not very elegant, but you could loop step the layouts, parse the layout
fields to a global, and pattern match on the target field (or filter)

You know the specific portal field, so that is good

e.g. calc: FieldNames ( g_FileNameA ; g_layoutNameA)

example field: IncomeLines_income_portal::income_id

As for the portal row max, that would require a bit more creativity, but
after identifying the layouts with the portal rel, a go to field (
finding a common field may be an issue) and loop records, set counter
.... would be how I would tackle it

It might be practical to use a demo version FM10 to convert the fm5, and
digest that; but fm5 to fm 10 may open a different can of worms. But
necessity being the mother and all...

Reply With Quote
  #3  
Old   
Your Name
 
Posts: n/a

Default Re: how to list the layouts with portals - 12-07-2009 , 06:19 PM



George Lewycky wrote:
Quote:
Hi I'm using FM5/Windows and we are converting to SQL Server.
I have 200+ layouts most of which are customer letters.

I'm trying find how to list all the layouts with a specific portal
field with a maximum of 5 rows.

Any ideas ?? Even having to list all the layouts to find the portal
field would be a real help
This appears to work in a simple test, but only if the Relationship is
defined to allow the Portal to create related records.

** CREATE A BACKUP OF THE DATABASE FIRST **

First you need to define two new Global fields - one to store a counter for
the looping so that it knows which Layout it processing and one to store the
complete list of Layouts that contain the Portal.
e.g.
g_LoopCounter Global, Number
g_LayoutList Global, Text

Next, if it isn't already, change the Relationship definition to allow the
creation of related records.

Now you can create a Script which loops through the Layouts one at a time
looking for the Portal - it does this by using the Go to Portal Row command
and Status(CurrentPortalRow) function. If the Portal does exist on the
Layout, then the current portal row will be 1. If the portal doesn't exist
the current portal row will be 0. The loop can be exited when the
g_LoopCounter is more than the number of Layouts.

Set Field [g_LoopCounter, 1]
Loop
Go to Layout [Layout Number From Field, g_LoopCounter]
Go to Portal Row [Select, First]
If [Status(CurrentPortalRow) = 0]
Set Field [g_LayoutList, g_LayoutList & "PP" &
Status(CurrentLayoutName)]
End If
Set Field [g_LoopCounter, g_LoopCounter + 1]
Exit Loop If [g_LoopCounter > {MaxLayouts}]
End Loop

Notes:
- The "PP" inside the If statement's Set Field command are really the
carriage return "backwards P" symbol.
- {MaxLayouts} should be the number of Layouts in the database.
You could use a high number like 999, but if the last Layout does
contain the Portal, it will appear multiple times in the list as the
Script keeps re-testing the last Layout.

After performing the Script, the g_LayoutList field will contain a list of
Layout names which have the Portal on it.

You can of course modify this Script to include the Layout number
(g_LoopCounter) or to list all the Layouts along with a "Yes" or "No" to
indicate whether the Portal exists on that Layout.

I haven't tested it, but you can probably modify it to only add Layouts
where the Portal has five (or more) rows by changing the middle part of the
Script to be:
Go to Portal Row [Select, Last]
If [Status(CurrentPortalRow) > 4]
Set Field [g_LayoutList, g_LayoutList & "PP" &
Status(CurrentLayoutName)]
End If


If there are multiple Relationships and multiple Portals, then you will need
to change the Go to Portal Row command to be the Go To Field command instead
(making sure to go to a Field that exists in the required Portal - the Field
needs to be in EVERY Portal you're looking for).
e.g.
Go to Field [Relationship::RelatedField]

For the modified "5 rows" version you would still have to have this Go to
Field command to get to the appropriate Portal, and then follow it with the
Go to Portal Row [Select, Last] command to get to the last row of that
Portal.


Helpfull Harry )

Reply With Quote
  #4  
Old   
105
 
Posts: n/a

Default Re: how to list the layouts with portals - 12-07-2009 , 08:51 PM



105 wrote:
Quote:
George Lewycky wrote:
Hi I'm using FM5/Windows and we are converting to SQL Server.
I have 200+ layouts most of which are customer letters.

I'm trying find how to list all the layouts with a specific portal
field with a maximum of 5 rows.

Any ideas ?? Even having to list all the layouts to find the portal
field would be a real help



This may not be relevant to FM5 George (too distant a memory), but in
later versions:

Not very elegant, but you could loop step the layouts, parse the layout
fields to a global, and pattern match on the target field (or filter)

You know the specific portal field, so that is good

e.g. calc: FieldNames ( g_FileNameA ; g_layoutNameA)

example field: IncomeLines_income_portal::income_id

As for the portal row max, that would require a bit more creativity, but
after identifying the layouts with the portal rel, a go to field (
finding a common field may be an issue) and loop records, set counter
... would be how I would tackle it

It might be practical to use a demo version FM10 to convert the fm5, and
digest that; but fm5 to fm 10 may open a different can of worms. But
necessity being the mother and all...

Thinking about this some more, counting the portal rows will be impacted
by the number of related records, so not a solution.

If the number of related records equal the defined portal rows, the
correct count can be returned.
If the number of related records is greater tahn the defined portal
rows, and the portal has scroll bar defined, the row count will equal
the related record count
if the related record count is less than the portal row definition, the
related record count, the count will be less than the row count...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.