![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
What on earth am I doing wrong? Thanks to various posts here over the years, I have been experimenting with using a self-join to populate a portal with ONLY contact names starting with a specific letter. This is what I have done: Designed a new database with only one table, and three fields - Name, Calc, and Filter. Name is a text field with surnames Calc is a global field which calculates the first letter of each name using Left (Name ; 1) This works perfectly Filter is a text field which uses a value list of each letter of the alphabet. |
)
#3
| |||
| |||
|
|
Hi Katie, I've created a simple example to prove that it does work as expected: https://rapidshare.com/files/4258230239/names.fp7 HTH, Martin |
#4
| ||||
| ||||
|
|
On Mon, 26 Sep 2011 18:33:44 +1200, Your Name wrote: unfortunately there's a hiccup here - you can't have a Calculation field on the right hand side of a Relationship since it can't be indexed (this may depend on what version of FileMaker you're using). That means the Calc field must instead be a normal Text field which uses an auto-enter calculation to obtain the result, but only once data has been entered into the Name field - the options for an auto-enter calculation are meant to do this, but are a bit flakey, so it's usually best to do it yourself. Has there ever been any FMP version which did not permit to save and index its value? It's true for calculations which did include a related value, but for a local left(name,1) it has always been possible to save and index its value. |
|
auto-enter by calculation: If(IsEmpty(Name); ""; Left(Name;1)) This way Calc remains empty while Name is empty, and FileMaker will perform the auto-enter calculation once Name has data entered into it. (Normally FileMaker will perform auto-enter options when the record is created.) not necessary - as long as name is empty, it won't be calculated. And even if it would, the result of left() on an empty field would return the value empty. |
|
This then causes a second problem - because Calc is a normal Text field, this also means that when the data is changed in the Name field, the Calc data will need to be changed either manually or via a script. .... or via the simpe checkbox option to recalculated the auto enter value on changing a field value. |
|
What I normally do in similar situations is create another field called OldName which is a normal Text field with an auto-enter calculation to copy the data from Name (again, only after it actually has some data). e.g. OldName Text auto-enter by calculation: If(IsEmpty(Name); ""; Name) Then you can have a Calculation field that checks to see if both Name and OldName contain the same data ... if not the field can display a warning (either tect of graphically). e.g. ChangedName Calculation, Text Result, Unstored = If(Name = OldName; ""; "Name has been changed!") Possible, but I do not see any profit from this here. |
)
#5
| |||
| |||
|
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |