![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 ![]() |
)
#3
| |||
| |||
|
|
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 * ) |

#4
| |||
| |||
|
|
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 ![]() |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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... |
#7
| |||
| |||
|
|
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. |
)
#8
| |||
| |||
|
|
"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. |
)
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |