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 4826 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Name & Parameters: EmptyFields ( object ; counter )

Description: This function is meant to take a tab name as the object parameter and return a 1 if any of the named fields are empty, 0 if they have values. The counter parameter should be 0.

Recursive: Yes

Sample Input:

 "tab.Science" ; 0 


 

Results:

 

Formula:


 /*Empty Fields ( object ; counter ) by David Jondreau, www.wingforward.net

This function is meant to take a tab name as the object parameter and return a 1 if any of the named fields are empty, 0 if they have values.

*/

 

Let([

objects = GetLayoutObjectAttribute ( object ; "containedObjects" ) ;

end = ValueCount ( objects ) ;

 

thisObject = GetValue ( objects ; counter ) ;

thisType = GetLayoutObjectAttribute ( thisObject ; "objectType" ) ;

isField = ( thisType = "field" ) ;

empty =   isField and IsEmpty ( GetLayoutObjectAttribute ( thisObject ; "content" ) ) ;

 

result = Case ( IsEmpty ( end ) ; 0 ; empty ; 1 ; counter  >=  end ; 0 ; EmptyFields ( object ; counter + 1 ) )

];

result

)

Credits:

David Jondreau

Posted

I don't trust $vars not to "step on each other" . If this function evaluates at the same time as another using the same named $var, I don't know if that will screw it up.

I suppose I could use a $var with a reasonably unique repetition.

Posted

If this function evaluates at the same time as another using the same named $var...

I can't think about such situation, each calculation field evaluates its calc and then pass to the next.

( naturally you'll have to set the $var to empty at the end of the calc )

Posted

Who create those functions ? The creator knows wich is the name of his $var.

And even if I want to call a CF created by anyone else, I first go to see which is the ( eventually ) used $var.

Posted

OK....what about scripts? If I use a $var in a script that has the same name as the $var in the function, that may cause errors. Functions should stand on their own and not require cross-checking.

I just can't think of a safe way to use $vars as counters. I'd love to, but I don't see it.

Posted

A function should stand independent. I have yet to find a way of using a $var in a function that avoids possible cross-contamination with script variables.

In your example, if $go or $old is used in script with the function, we'll get bad results.

Posted

Do you think it would be safe in this way?

Let(

$_cf_$counter = $_cf_$counter + 1 ;

$_cf_$counter & If ( $_cf_$counter < 10 ; ¶ & counter ; Let ( $_cf_$counter = "" ; "" ) )

)

Posted

Now that's clever...That's better (can't use the script step Set Variable[]), but the problem is still that $vars are scoped to a script not a calc and there can be cross-pollination. A function should be self-contained, but with $vars you can influence them from the outside.

Posted

... and something like this ?

Let(

$.$counter = FilterValues ( $.$counter & "¶**ThisIsACounter**" ; "**ThisIsACounter**" ) ;

ValueCount ( $.$counter ) & If ( ValueCount ( $.$counter ) < 10 ; ¶ & counter ; Let ( $.$counter = "" ; "" ) )

)

Naturally the string could be any combination of chars.

Why would someone set an $var to be such strange ?

This topic is 4826 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.