dbTalk Databases Forums  

View only one of many repeats in portal

comp.databases.filemaker comp.databases.filemaker


Discuss View only one of many repeats in portal in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kathryn Fletcher
 
Posts: n/a

Default View only one of many repeats in portal - 06-30-2004 , 02:14 AM






I have found a number of examples on how to do this but I can not seem
to apply them to my database. I am a new user of filemaker pro
previously used access.

I have a parent file (Main) and a Child file (Litter). Related by
Box#.

I want to view information from Litter in Main via a portal.

In Litter there are a number of fields that have repeated information.
eg
Box# - 1
Litter# - 1
#WT - 5
Toe# - 1

Box# - 1
Litter# - 1
#WT - 5
Toe# - 2

From this example you can see that there is only one difference the
toe#.

If I make a portal in Main with the relation Box# and the fields that
I know are repeated ie Litter# and #WT (the portal will only be used
to view repeated values) Litter# and #WT will come up as many times as
there are toe#. I only want to see it once.

Therefore I will be able to view
Box# 1
Litter# #WT
1 5
2 3
3 6

Not

Box# 1
Litter# #WT
1 5
1 5
1 5
1 5
2 3
2 3
2 3
3 6
3 6

(Box# is on the main form).
ie I want the portal to act as summary of repeated information.

Note: There is more than the one field that is not repeated, these
fields act as a caculation for the fields that I want in the summary.
ie there is a field were you enter genotype with a drop menu, WT being
one answer. This is used to caculate the #WT field that I want in the
summary. Point of this, repeations of data are required.

If anyone has any ideas I would be entirley grateful for your help.

Kathryn

Reply With Quote
  #2  
Old   
Chris Brown
 
Posts: n/a

Default Re: View only one of many repeats in portal - 07-01-2004 , 07:28 PM






save yourself the effort, and simply parse the repeat field data into a
dedicated table; easily done by an import. Manipulations will then be
much easier. Most will point out repeat fields are a largely a 'legacy'
approach to holding data. They are useful for holding universal
parameters such as perference settings and hilites. They do have their
devotees/conjurers however.


Chris Brown
Neurosurgery
University of Adelaide


Kathryn Fletcher wrote:

Quote:
I have found a number of examples on how to do this but I can not seem
to apply them to my database. I am a new user of filemaker pro
previously used access.

I have a parent file (Main) and a Child file (Litter). Related by
Box#.

I want to view information from Litter in Main via a portal.

In Litter there are a number of fields that have repeated information.
eg
Box# - 1
Litter# - 1
#WT - 5
Toe# - 1

Box# - 1
Litter# - 1
#WT - 5
Toe# - 2

From this example you can see that there is only one difference the
toe#.

If I make a portal in Main with the relation Box# and the fields that
I know are repeated ie Litter# and #WT (the portal will only be used
to view repeated values) Litter# and #WT will come up as many times as
there are toe#. I only want to see it once.

Therefore I will be able to view
Box# 1
Litter# #WT
1 5
2 3
3 6

Not

Box# 1
Litter# #WT
1 5
1 5
1 5
1 5
2 3
2 3
2 3
3 6
3 6

(Box# is on the main form).
ie I want the portal to act as summary of repeated information.

Note: There is more than the one field that is not repeated, these
fields act as a caculation for the fields that I want in the summary.
ie there is a field were you enter genotype with a drop menu, WT being
one answer. This is used to caculate the #WT field that I want in the
summary. Point of this, repeations of data are required.

If anyone has any ideas I would be entirley grateful for your help.

Kathryn


Reply With Quote
  #3  
Old   
Helpful Harry
 
Posts: n/a

Default Re: View only one of many repeats in portal - 07-02-2004 , 03:34 AM



In article <8f1ffc44.0406292314.2c9ab773 (AT) posting (DOT) google.com>,
kafjob (AT) hotmail (DOT) com (Kathryn Fletcher) wrote:

Quote:
I have found a number of examples on how to do this but I can not seem
to apply them to my database. I am a new user of filemaker pro
previously used access.

I have a parent file (Main) and a Child file (Litter). Related by
Box#.

I want to view information from Litter in Main via a portal.

In Litter there are a number of fields that have repeated information.
eg
Box# - 1
Litter# - 1
#WT - 5
Toe# - 1

Box# - 1
Litter# - 1
#WT - 5
Toe# - 2

From this example you can see that there is only one difference the
toe#.

If I make a portal in Main with the relation Box# and the fields that
I know are repeated ie Litter# and #WT (the portal will only be used
to view repeated values) Litter# and #WT will come up as many times as
there are toe#. I only want to see it once.

Therefore I will be able to view
Box# 1
Litter# #WT
1 5
2 3
3 6

Not

Box# 1
Litter# #WT
1 5
1 5
1 5
1 5
2 3
2 3
2 3
3 6
3 6

(Box# is on the main form).
ie I want the portal to act as summary of repeated information.

Note: There is more than the one field that is not repeated, these
fields act as a caculation for the fields that I want in the summary.
ie there is a field were you enter genotype with a drop menu, WT being
one answer. This is used to caculate the #WT field that I want in the
summary. Point of this, repeations of data are required.

If anyone has any ideas I would be entirley grateful for your help.

Kathryn
It depends what you're going to do with this list.

If you're trying to print a report, then do not use portals. Instead
print the report from the Litter file using Sub-summary parts to
collate all the same Litter# records for each Box#.


If you're only wanting to display the records on-screen via the portal,
then off the top of my head, with no testing ...

You could create a new self-relationship and a couple of new fields in
the Litter file that are used to work out which is the first entry of
each type which can then be picked up by a new Main -> Litter
relationship.

First you need to be able to group together all the Litter records that
have the same Litter# and Box#. The easiest way is to create a new
field that sticks thes two numbers together, but it can't be a
calculated field since those can't be used on the child end of a
relationship. That means using a normal Text field with an auto-enter
calculation.
eg.
Box#Litter# {text, auto-enter calculation}
= If (IsEmpty(Box#) or IsEmpty(Litter#),
"",
Box# & "-" & Litter#)

The IsEmpty functions are needed to ensure that the Box#Litter# field
only calculates when both of the source fields contain data (there
seems to be a bug in some versions of FileMaker where the "do not
calculate if fields are empty" option doesn't always work).

This enables you to create a self-relation within the Litter file to
group all the same related records together.
eg.
LitterGroup {relationship in Litter file}
Box#Litter# = Litter::Box#Litter#

You can now create another new field in Litter to indicate whether a
new record is the first in the group or not by using the Count
function. Again this must be a normal text field using an auto-enter
calculation since it will be used as the child end of a relationship
from the Main file.
eg. FirstRecord {text, auto-enter calculation}
= if (IsEmpty(Box#) or (IsEmpty(Count(LitterGroup::Box#))),
"",
Box# & "-" & Count(LitterGroup::Box#)+1)

For each individual Box# this field will put a "-1" after the Box# of
the first record, "-2" for the second, etc.

Next, in the Main file you will need to create a calculated field that
joins Box# and "1" together
eg.
FirstRecordSource {calculation, text result}
= Box# & "-1"

which will enable you to link to the Litter file and obtain only the
first record from each group via a new relationship in the Main file.
eg.
FirstLitter {relationship in Main file}
FirstRecordSource = Litter::FirstRecord

Use this relationship for your portal and you should (hopefully) get
only one of each Litter# for each Box#.



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #4  
Old   
Kathryn Fletcher
 
Posts: n/a

Default Re: View only one of many repeats in portal - 07-07-2004 , 07:27 PM



Thanks for the responses,

I am currently redesigning the database to work as one file. So I am
seeing if this works better for what I am trying to achieve. Thankyou
for your responses and I will take them on board on try 2 of designing
the database.


Helpful Harry <helpful_harry (AT) nom (DOT) de.plume.com> wrote

Quote:
In article <8f1ffc44.0406292314.2c9ab773 (AT) posting (DOT) google.com>,
kafjob (AT) hotmail (DOT) com (Kathryn Fletcher) wrote:

I have found a number of examples on how to do this but I can not seem
to apply them to my database. I am a new user of filemaker pro
previously used access.

I have a parent file (Main) and a Child file (Litter). Related by
Box#.

I want to view information from Litter in Main via a portal.

In Litter there are a number of fields that have repeated information.
eg
Box# - 1
Litter# - 1
#WT - 5
Toe# - 1

Box# - 1
Litter# - 1
#WT - 5
Toe# - 2

From this example you can see that there is only one difference the
toe#.

If I make a portal in Main with the relation Box# and the fields that
I know are repeated ie Litter# and #WT (the portal will only be used
to view repeated values) Litter# and #WT will come up as many times as
there are toe#. I only want to see it once.

Therefore I will be able to view
Box# 1
Litter# #WT
1 5
2 3
3 6

Not

Box# 1
Litter# #WT
1 5
1 5
1 5
1 5
2 3
2 3
2 3
3 6
3 6

(Box# is on the main form).
ie I want the portal to act as summary of repeated information.

Note: There is more than the one field that is not repeated, these
fields act as a caculation for the fields that I want in the summary.
ie there is a field were you enter genotype with a drop menu, WT being
one answer. This is used to caculate the #WT field that I want in the
summary. Point of this, repeations of data are required.

If anyone has any ideas I would be entirley grateful for your help.

Kathryn

It depends what you're going to do with this list.

If you're trying to print a report, then do not use portals. Instead
print the report from the Litter file using Sub-summary parts to
collate all the same Litter# records for each Box#.


If you're only wanting to display the records on-screen via the portal,
then off the top of my head, with no testing ...

You could create a new self-relationship and a couple of new fields in
the Litter file that are used to work out which is the first entry of
each type which can then be picked up by a new Main -> Litter
relationship.

First you need to be able to group together all the Litter records that
have the same Litter# and Box#. The easiest way is to create a new
field that sticks thes two numbers together, but it can't be a
calculated field since those can't be used on the child end of a
relationship. That means using a normal Text field with an auto-enter
calculation.
eg.
Box#Litter# {text, auto-enter calculation}
= If (IsEmpty(Box#) or IsEmpty(Litter#),
"",
Box# & "-" & Litter#)

The IsEmpty functions are needed to ensure that the Box#Litter# field
only calculates when both of the source fields contain data (there
seems to be a bug in some versions of FileMaker where the "do not
calculate if fields are empty" option doesn't always work).

This enables you to create a self-relation within the Litter file to
group all the same related records together.
eg.
LitterGroup {relationship in Litter file}
Box#Litter# = Litter::Box#Litter#

You can now create another new field in Litter to indicate whether a
new record is the first in the group or not by using the Count
function. Again this must be a normal text field using an auto-enter
calculation since it will be used as the child end of a relationship
from the Main file.
eg. FirstRecord {text, auto-enter calculation}
= if (IsEmpty(Box#) or (IsEmpty(Count(LitterGroup::Box#))),
"",
Box# & "-" & Count(LitterGroup::Box#)+1)

For each individual Box# this field will put a "-1" after the Box# of
the first record, "-2" for the second, etc.

Next, in the Main file you will need to create a calculated field that
joins Box# and "1" together
eg.
FirstRecordSource {calculation, text result}
= Box# & "-1"

which will enable you to link to the Litter file and obtain only the
first record from each group via a new relationship in the Main file.
eg.
FirstLitter {relationship in Main file}
FirstRecordSource = Litter::FirstRecord

Use this relationship for your portal and you should (hopefully) get
only one of each Litter# for each Box#.



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)

Reply With Quote
  #5  
Old   
Kathryn Fletcher
 
Posts: n/a

Default Re: View only one of many repeats in portal - 07-08-2004 , 08:51 PM



Found a solution to my question. I am posting the answer so that when
someone else is trying to do the same thing they don't just see a
message, 'I figured it out' - nothing worse than finding exactly what
you want and not how to do it.

Few changes to last message, Changed database so there is only one
file.
and
Box# is now Birthbox.

I looked at using the sub-summary as mentioned by Helpful Harry since
all my data is in the one file (did not want to the person using
database to have to go into another file in order to get information,
wanted it to all work in that file.) Could not get it to work, may
have been doing something wrong. I think the reason I could not get it
to work was because all the information I want in the table is not a
summary ie Litter #. For this field I just want to hide duplicates not
summarise any data. Therefore could not make a summary field to put
into the sub-summary.

(I am going to give example using field names from my database, so
obviously just replace them with ones you are using)

1)
Make fields.
Name - Birthbox
Type - Text

Name - Litter
Type - Text

Name - gBox
Type - Global
Options - text.

Name - gLitter
Type - global
Options - text

Name - show
Type - text

2)
Make relationships.
Name - ~gbox
Relationship - gBox = ::BirthBox_show

Name - ~gbox_2
Relationship - gBox = ::BirthBox

3)
Make a value list.
Name - boxes
Source - from field
Value - Birthbox

4)
Make a script.
Name - Refresh

Go to Related Record [~gbox_2]
[Show only related records]
Sort [Sort Order: BirthBox (Ascending) Litter (Ascending) ]
[Restore sort order, No dialog]
Go to Record/Request/Page
[First]
Set Field [gLitter, Litter]
Set Field [ show, ""]
Go to Record/Request/Page
[Next]
Loop
If [Litter=gLitter]
Set Field [show, 0]
Else
Set field [show, "]
End If
Set Field [gLitter, Litter]
Go to Record/Request/Page
[Next, Exit after last]
End Loop
Go to Layout [original layout]
Show all records

5) Make a new page layout
Header
Place field - gbox, from current file, format field to make it
pop-uplist using values from boxes.
Place button - control, perform script. Specify - Refresh. Current
script - pause.
Body
Place Portal - from ~gbox (ie information from relationship created).
Then place in the fields of interest. Ie Litter #.

When you go back to Browse mode go to the popup list and choose a
Birthbox. You should get something like this

gBox - 5 Refresh button

Litter #females
1 3
1 3
1 3
1 3
2 4
2 4

Hit the refresh button and it will change to

gBox - 5 Refresh button

Litter #females
1 3
2 4

Once you have pressed the refresh button for a particular Birthbox,
you should not have to press it again unless new information has been
entered or the database has been closed down.
Moral of story, if there are multiple entries in the portal press
refresh.

I had someone help me with this. It seems a very long way to go about
it but it works so I am not complaining.
I am unsure how it will work if using a portal that is not from the
same file as the script I presume will not work.

Hopefully this is a help to someone in the future.


kafjob (AT) hotmail (DOT) com (Kathryn Fletcher) wrote in message news:<8f1ffc44.0406292314.2c9ab773 (AT) posting (DOT) google.com>...
Quote:
I have found a number of examples on how to do this but I can not seem
to apply them to my database. I am a new user of filemaker pro
previously used access.

I have a parent file (Main) and a Child file (Litter). Related by
Box#.

I want to view information from Litter in Main via a portal.

In Litter there are a number of fields that have repeated information.
eg
Box# - 1
Litter# - 1
#WT - 5
Toe# - 1

Box# - 1
Litter# - 1
#WT - 5
Toe# - 2

From this example you can see that there is only one difference the
toe#.

If I make a portal in Main with the relation Box# and the fields that
I know are repeated ie Litter# and #WT (the portal will only be used
to view repeated values) Litter# and #WT will come up as many times as
there are toe#. I only want to see it once.

Therefore I will be able to view
Box# 1
Litter# #WT
1 5
2 3
3 6

Not

Box# 1
Litter# #WT
1 5
1 5
1 5
1 5
2 3
2 3
2 3
3 6
3 6

(Box# is on the main form).
ie I want the portal to act as summary of repeated information.

Note: There is more than the one field that is not repeated, these
fields act as a caculation for the fields that I want in the summary.
ie there is a field were you enter genotype with a drop menu, WT being
one answer. This is used to caculate the #WT field that I want in the
summary. Point of this, repeations of data are required.

If anyone has any ideas I would be entirley grateful for your help.

Kathryn

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 - 2013, Jelsoft Enterprises Ltd.