Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Changing color of Button if Field is populated


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

Recommended Posts

Posted

You can have a calculation container field that selects different container field values.

In other words, you can have a repeating field of n number of repeats for a field called dButton. The global container field will have the n, number of images of the different colors that you want in there. In this case you would have two images. Then in your calculation field, you can have it show the repeating number depending on your criteria.

Case ( not IsEmpty (field1); dButton[2]; dButton[1])

Then you can have this field act as a button.

Posted

Is dbutton the image? and how do I place the image within a container that has a calculation?

sorry if I am stupid about this. Just never did it before.

Thanks

Posted

Note that from 7 forward, it's even easier to write because you can drop it from ...

Case ( IsEmpty ( field1 ) ; GetRepetition ( dButton ; 1 ) ; GetRepetition ( dButton ; 2 ))

.... to

Case ( IsEmpty ( field1 ) ; dButton ; dButton [ 2 ] )

I forget frequently myself and start to write it the old-fashioned way. This new enhancement tickles me - repeater calcs are much easier to write! :wink2:

L

Posted

Yeah it took me a while to get used to dropping the GetRepetition too, but now I almost never use it; always preferring the shortcut.

:)

Posted

GetRepetition( field, 1 ) isn't necessary in previous versions either, btw, if the calc field is a single repetition result; just field by itself will suffice. (But I'm sure I've stated this enough previously. :wink2:)

In this case, you can also use

dButton[not IsEmpty(field1) + 1]

if you want to be tricky.

Posted

Okay JT, jeeze

A few points need to be made since you guys feel the necessity to "Pile On"

1). It was a demo of mr_vodka's calculation, to help Jscott understand the fields involved.

2). I do not have a client using v7 or v8 yet. So I'm still a newbee with these when it comes to these short cuts.

3). If I write the calculation in v6, and then convert the file in v7, the calculation stays as written in v6.

4). I purchased the REFER file by JMO to help bridge this gap, but guess what? He doesn't have an example of any Repeating Fields.

I have made myself a file using the techniques mention here for future reference.

Now, will you get off of me so I can I get up and dust myself off?

Lee

Posted

I wasn't piling on you, Lee. I am underneath you, therefore I am supporting you and being piled on myself. :wink2:

Posted

Hi JT,

LOL, It was a Joke....

I love the way we can shorten some of these formulas.

One thing that keeps bothering me though is, that I learned a lot about how FileMaker evaluates the functions when they were written out like the example [color:blue]Case ( IsEmpty ( field1 ) ; GetRepetition ( dButton ; 1 ) ; GetRepetition ( dButton ; 2 )), and wonder how a newbee can make the jump to [color:blue] dButton[not IsEmpty(field1) + 1].

Maybe we should show the long and the short formulas, as a learning aid.

Just a thought.

Lee

:cool:

Posted

Well, I want to be tricky. Always, JT. :wink2:

But I see more to it than a siimple, single repetition specification, IIUC. It's quite exciting if a calculation, field (if number), boolean, etc. can be used to specify a repetition!!! That can extend reps all by itself!!!!!! Even based upon ValueCount and PatternCount and ... wow.

I hope I'm not going off on a tangent ... you know how I get. Well, your thoughts would be appreciated but it feels quite powerful to me. :laugh2:

Oh!!! I just got word SecureFM w/Menu Magic is out for vs. 8!!!! I can finally move forward!! Life rocks!

LaRetta

Posted

This could have been done in previous versions as

GetRepetition( dButton, (not IsEmpty(field1)) + 1 )

so it is not necessarily a new feature, but is definitely simplified now. Interestingly enough, the calculation does not work in earlier versions, if you do not include the parentheses around 'not IsEmpty(field1)'. I am not certain why this is required for it to treat the boolean expression as a numerical result, but I thought I would include the caveat for anyone interested.

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