dbTalk Databases Forums  

help about relationship please

comp.databases.filemaker comp.databases.filemaker


Discuss help about relationship please in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alkan Kutluhan ÜNÜVAR
 
Posts: n/a

Default help about relationship please - 08-01-2010 , 02:52 PM






i have two layouts (layoutA and layoutB) and both of layouts have
number fields.(numberA and numberB)
numberA and numberB are number codes. but number code is to be used in
common.(serial number)
and number codes is generated on creation
for example when a new record is opened in layoutA; numberA field=1.
then when a new record is opened in layoutA again numberA field=2
then when a new record is opened in layoutB numberB field=3
then when a new record is opened in layoutA numberA field=4
and so on;
how can i do this?
help me please

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

Default Re: help about relationship please - 08-01-2010 , 04:06 PM






"Alkan Kutluhan ÜNÜVAR" <alkan.unuvar (AT) gmail (DOT) com> wrote

Quote:
i have two layouts (layoutA and layoutB) and both of layouts have
number fields.(numberA and numberB)
numberA and numberB are number codes. but number code is to be used in
common.(serial number)
and number codes is generated on creation
for example when a new record is opened in layoutA; numberA field=1.
then when a new record is opened in layoutA again numberA field=2
then when a new record is opened in layoutB numberB field=3
then when a new record is opened in layoutA numberA field=4
and so on;
how can i do this?
help me please
If you really mean Layouts (rather than Tables or database files), then you
don't need a Relationship. All you need is a Number Field defined to use the
Auto-enter option of a Serial Number. It doesn't matter what Layout you're
on when you create the Record, it will automatically get the next serial
number value.

Helpfull Harry )

Reply With Quote
  #3  
Old   
Alkan Kutluhan ÜNÜVAR
 
Posts: n/a

Default Re: help about relationship please - 08-01-2010 , 05:10 PM



Quote:
If you really mean Layouts (rather than Tables or database files), then you
don't need a Relationship. All you need is a Number Field defined to use the
Auto-enter option of a Serial Number. It doesn't matter what Layout you're
on when you create the Record, it will automatically get the next serial
number value.

Helpfull Harry *)

thanks a lot Harry for your answer,
but the number fields are different tables, but same files.
how can i do?
thanks again

Reply With Quote
  #4  
Old   
Lynn Allen
 
Posts: n/a

Default Re: help about relationship pleaseX-TraceApproved - 08-01-2010 , 08:44 PM



On 2010-08-01 15:10:33 -0700, Alkan Kutluhan ÜNÜVAR
<alkan.unuvar (AT) gmail (DOT) com> said:

Quote:
If you really mean Layouts (rather than Tables or database files), then y
ou
don't need a Relationship. All you need is a Number Field defined to use
the
Auto-enter option of a Serial Number. It doesn't matter what Layout you'r
e
on when you create the Record, it will automatically get the next serial
number value.

Helpfull Harry *)


thanks a lot Harry for your answer,
but the number fields are different tables, but same files.
how can i do?
thanks again
You can't do this with straight serial numbers, but you can get
something similar which may suit your purposes.

The Max() function can take more than one field as an argument. So if
you make each field an auto-enter calc with the calculation:

Max(LocalFieldName; OtherTableFieldName) + 1

It will return the highest of the two values, plus one. Since it's an
autoenter calc, it can be indexed.

Please note, if someone creates records in BOTH tables simultaneously,
this will fail. So it is fragile, not robust, especially if the traffic
in the db is heavy.

You might want to consider other options. If you're using this to
serialize or count the records in two tables, there are better ways.
You could, if you wanted to make sure that no record in either table
has the *same* serial as the other, run different sequences...for
instance, one sequence can start at 1, the other at 10000001, or
whatever number will put it beyond the expected population of the other
table.

Hope this actually answers your question.
--
Lynn Allen
--
www.semiotics.com
Member FBA
FM 10 Certified Developer

Reply With Quote
  #5  
Old   
Alkan Kutluhan ÜNÜVAR
 
Posts: n/a

Default Re: help about relationship please - 08-02-2010 , 07:35 AM



Quote:
You can't do this with straight serial numbers, but you can get
something similar which may suit your purposes.

The Max() function can take more than one field as an argument. *So if
you make each field an auto-enter calc with the calculation:

Max(LocalFieldName; OtherTableFieldName) + 1

It will return the highest of the two values, plus one. Since it's an
autoenter calc, it can be indexed.

Please note, if someone creates records in BOTH tables simultaneously,
this will fail. So it is fragile, not robust, especially if the traffic
in the db is heavy.

You might want to consider other options. If you're using this to
serialize or count the records in two tables, there are better ways.
You could, if you wanted to make sure that no record in either table
has the *same* serial as the other, run different sequences...for
instance, one sequence can start at 1, the other at 10000001, or
whatever number will put it beyond the expected population of the other
table.

Hope this actually answers your question.
--
Lynn Allen

thanks for your advice Lynn Allen
but there is a problem.
max is not working with two fields
Max(LocalFieldName; OtherTableFieldName) + 1
if i do
max(LocalFieldName)
it works.

in my program i use one serial number in two different
layouts(tables).
when a new record opened in layoutA, numberfieldA will be 1.
when a new record opened in layoutB, numberfieldB will be 2
and so on...
thanks

Reply With Quote
  #6  
Old   
Lynn Allen
 
Posts: n/a

Default Re: help about relationship pleaseX-TraceApproved - 08-02-2010 , 10:26 AM



On 2010-08-02 05:35:19 -0700, Alkan Kutluhan ÜNÜVAR
<alkan.unuvar (AT) gmail (DOT) com> said:

Quote:
thanks for your advice Lynn Allen
but there is a problem.
max is not working with two fields
Max(LocalFieldName; OtherTableFieldName) + 1
if i do
max(LocalFieldName)
it works.

in my program i use one serial number in two different
layouts(tables).
when a new record opened in layoutA, numberfieldA will be 1.
when a new record opened in layoutB, numberfieldB will be 2
and so on...
1. You don't tell us what your version of FM is. The two argument Max
works fine in FM8.5 (see the help for correct syntax).

2. You tell us WHAT you want, but not WHY. What's the reasoning behind
the exclusive serials in two different tables? Since we've all
concluded what you want isn't going to work directly with serials, you
need to tell us what your purpose is, so we can perhaps suggest another
way to accomplish what you need.

Maybe the use of two different tables isn't the best way to do what you want.
--
Lynn Allen
--
www.semiotics.com
Member FBA
FM 10 Certified Developer

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

Default Re: help about relationship please - 08-02-2010 , 04:19 PM



"Alkan Kutluhan ÜNÜVAR" <alkan.unuvar (AT) gmail (DOT) com> wrote

Quote:
thanks for your advice Lynn Allen
but there is a problem.
max is not working with two fields
Max(LocalFieldName; OtherTableFieldName) + 1
if i do
max(LocalFieldName)
it works.
I'm not sure if you can access OtherTableFieldName directly like that even
in newer versions of FileMaker, so this is why you will probably need the
Relationship created to allow one Table to access data from another Table.

1. Create a new Global Text Field in TableA called g_AParentLink

2. Temporarily put the g_AParentLink Field onto any TableA Layout
and type the data "ALL" into it (without the quote marks)

3. Create a new Text Field in TableB called BChildLink and set the
Auto-enter options to enter the data "ALL" (without quote marks)

4. Define a Relationship in TableA called rel_AtoB linking TableA
to TableB when g_AParentLink = TableB::BChildLink
This links all the records in TableB to all the records in TableA

5. Re-define the Serial number Field in TableA to use the Auto-enter
option by calculation:
Max(ASerial; rel_AtoB::BSerial)
where ASerial is the serial number Field in TableA and BSerial is
the serial number Field in TableB

6. Create a new Global Text Field in TableB called g_BParentLink

7. Temporarily put the g_BParentLink Field onto any TableB Layout
and type the data "ALL" into it (without the quote marks)

8. Create a new Text Field in TableA called AChildLink and set the
Auto-enter options to enter the data "ALL" (without quote marks)

9. Define a Relationship in TableB called rel_BtoA linking TableB to
TableA when g_BParentLink = TableA::AChildLink
This links all the records in TableA to all the records in TableB

10. Re-define the Serial number Field in TableB to use the Auto-enter
option by calculation:
Max(BSerial; rel_BtoA::ASerial)
where ASerial is the serial number Field in TableA and BSerial is
the serial number Field in TableB


Note: If you ever use the Save As options to save the databases file(s) to a
nwe file(s), you may have to re-enter the data "ALL" (wihtout quote marks)
into the two Global Text Fields. Some of the Save As options delete all
stored data, including that stored in Global Fields.


Helpfull Harry )

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

Default Re: help about relationship please - 08-02-2010 , 04:26 PM



"Your Name" <your.name (AT) isp (DOT) com> wrote

Quote:
"Alkan Kutluhan ÜNÜVAR" <alkan.unuvar (AT) gmail (DOT) com> wrote in message
news:d1b6616b-226c-45f9-a8ca-f49d05c01e12 (AT) x18g2000pro (DOT) googlegroups.com...

thanks for your advice Lynn Allen
but there is a problem.
max is not working with two fields
Max(LocalFieldName; OtherTableFieldName) + 1
if i do
max(LocalFieldName)
it works.

I'm not sure if you can access OtherTableFieldName directly like that even
in newer versions of FileMaker, so this is why you will probably need the
Relationship created to allow one Table to access data from another Table.

1. Create a new Global Text Field in TableA called g_AParentLink

2. Temporarily put the g_AParentLink Field onto any TableA Layout
and type the data "ALL" into it (without the quote marks)

3. Create a new Text Field in TableB called BChildLink and set the
Auto-enter options to enter the data "ALL" (without quote marks)

4. Define a Relationship in TableA called rel_AtoB linking TableA
to TableB when g_AParentLink = TableB::BChildLink
This links all the records in TableB to all the records in TableA

5. Re-define the Serial number Field in TableA to use the Auto-enter
option by calculation:
Max(ASerial; rel_AtoB::BSerial)
where ASerial is the serial number Field in TableA and BSerial is
the serial number Field in TableB

6. Create a new Global Text Field in TableB called g_BParentLink

7. Temporarily put the g_BParentLink Field onto any TableB Layout
and type the data "ALL" into it (without the quote marks)

8. Create a new Text Field in TableA called AChildLink and set the
Auto-enter options to enter the data "ALL" (without quote marks)

9. Define a Relationship in TableB called rel_BtoA linking TableB to
TableA when g_BParentLink = TableA::AChildLink
This links all the records in TableA to all the records in TableB

10. Re-define the Serial number Field in TableB to use the Auto-enter
option by calculation:
Max(BSerial; rel_BtoA::ASerial)
where ASerial is the serial number Field in TableA and BSerial is
the serial number Field in TableB


Note: If you ever use the Save As options to save the databases file(s) to
a
nwe file(s), you may have to re-enter the data "ALL" (wihtout quote marks)
into the two Global Text Fields. Some of the Save As options delete all
stored data, including that stored in Global Fields.
Opps!! Sorry, those two Auto-enter calculations should of course have been:

Max(ASerial; rel_AtoB::BSerial) + 1
and Max(BSerial; rel_BtoA::ASerial) + 1

since you want to increase the number by 1 with each new record in either
TableA or TableB.


Helpfull Harry )

Reply With Quote
  #9  
Old   
Alkan Kutluhan ÜNÜVAR
 
Posts: n/a

Default Re: help about relationship please - 08-05-2010 , 06:29 AM



thanks a lot for your advice Harry and Lynn Allen

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.