October 11, 200520 yr Does anyone know what the calculation would be to change the color of a button when a field in another layout is populated? Thanks
October 11, 200520 yr 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.
October 11, 200520 yr Author 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
October 11, 200520 yr Here is a sample of what mr_vodka describes. Ignore the Name of file, as it has no significance on the file itself. Lee ButtonScript.fp7.zip
October 11, 200520 yr 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! L
October 11, 200520 yr 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. :)
October 11, 200520 yr 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. ) In this case, you can also use dButton[not IsEmpty(field1) + 1] if you want to be tricky.
October 11, 200520 yr 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
October 12, 200520 yr I wasn't piling on you, Lee. I am underneath you, therefore I am supporting you and being piled on myself. :wink2:
October 12, 200520 yr 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:
October 12, 200520 yr Well, I want to be tricky. Always, JT. 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. Oh!!! I just got word SecureFM w/Menu Magic is out for vs. 8! I can finally move forward!! Life rocks! LaRetta
October 12, 200520 yr 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.
Create an account or sign in to comment