Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5776 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

The following unstored, Calculation yields a result of "Yes":

field_Test = Case ( RightWords( GetFieldName ( Self ) ; 1 ) = "Test" ; "Yes" ; "No" )

The following unstored calc, where Field is any field in the table, yields no result (Null):

field_Test = Case ( RightWords( GetFieldName ( Self ) ; 1 ) = "Test" ; Field ; "No" )

Why does this not work? That is, why does the calc work when the true case result is literal text, and it does not work when the true case result is a field. Note that the calc result is set to the correct data type, so date type mismatch is not the issue.

Darren

Darren Burgess

Posted

Clarification - This issue is related to the storage of the calc.

So this calc:

field_Test = Case ( RightWords( GetFieldName ( Self ) ; 1 ) = "test" ; AnyField ; NULL )

When the results are unstored, either because it is manually set to unstored or because AnyField is an unstored field, then the calc breaks.

Why?

Posted

Hmmm...the more reductive question is:

An unstored calc field = GetFieldName(Self) returns the correct result.

An unstored calc field = RightWords(GetFieldName(Self) returns a null result.

Weird.

In fact,

Let(

$name = GetFieldName(Self);

$name)

returns a null result, though the var $name is created.

Posted (edited)

So what the heck is going on?

1) For:

GetFieldName ( Self ) & "X"

I get TABLE::Field

2) For:

"X " & GetFieldName ( Self )

I get X TABLE::Field

3) For

Let([

$start = "Start";

$name = GetFieldName(Self);

$end = "End"];

1

)

I get a null result, but the $start and $end vars are populated.

If I change the storage from unstored to stored, I get the correct result.

Edited by Guest
Posted

I don't know. Frankly, I'm surprised that ANY reference to Self in an unstored calculation doesn't return an error. But in fact Self + 1 returns 1, which is clearly incorrect.

I suppose there is some safeguard in place to prevent an infinite loop in case of circular reference, and it kicks in even though GetFieldName ( Self ) isn't really a reference to self.

Posted

ok, from another forum I got this response.

"Ah!

In an unstored calc the SELF function (or any self reference) doesn't resolve until the whole calculation finishes. It is the stored value which allows the GETFIELDNAME to resolve correctly. Not sure how to get around this."

Darren

Posted

further clarification of the actual problem to solve:

Basically what I was trying to do, in a calculation field, was to use exactly the same calculation for each of several fields. Looking something like this:

calcField_Nurse = Case ( RightWords (GetFieldName ( Self ) ; 1 = Category ) ; anotherCalcField ; NULL )

calcField_Surgeon = Case ( RightWords (GetFieldName ( Self ) ; 1 = Category ) ; anotherCalcField ; NULL )

etc, etc

Where category is one of several person categories ( Nurse, Physician, Surgeon, etc) and anotherCalcField is unstored since it references another table.

I have sort of solved this with a custom function, but I am curious if it is possible to do this directly in the calculation.

Darren

Posted

from another forum I got this response.

"Ah!

In an unstored calc the SELF function (or any self reference) doesn't resolve until the whole calculation finishes. It is the stored value which allows the GETFIELDNAME to resolve correctly. Not sure how to get around this."

Could you name the source of this information, please?

I am not sure what exactly is your overall purpose here. Perhaps if we knew that, a simpler solution would present itself.

This topic is 5776 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.