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

Changing object size based on field value


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

Recommended Posts

Posted

Hi, is the following possible?

DB has two numeric fields and one object (or 3rd field).

Can one trigger changing the size of the object by changing the values in the num. fields.

Exp.1: num field one has value 5, and num. field two hase value 9. I need than the object to start 5" from the edge of the current window, and end 9" from the edge.

Exp.2: Field one has value 4 and the object is 4" long, you change value to 2 and the object resizes to 2".

Is that something I should put in my FM10 wish list, or there is a magic solution to any of the exp.'s now in FM9 and I can't see it?

Posted

If you can build your object from types found in say the webding font, could it be resized when shown as a mergefield via:

http://www.filemaker.com/help/FunctionsRef-394.html

--sd

Posted

But than the field will increase in size in both directions, I need it to go only horizontally or vertically. Also, if the field bounds are smaller the text will start do disappear. Nice idea, but won't work for me. Anything else?

Posted

Is this a graphing solution? You can make a field so narrow that several webding "g" stacks upon each other, this is vertical for you! The only thing to remember is to fiddle a little with the linespacing so the blocks makes one massiv.

--sd

Untitled.zip

Posted

: ,

I amazed how the left brain works for some people in approaching the problem and getting a solution for it. In your case, i found it worked brilliantly.

Thanks for sharing.

  • 2 weeks later...
Posted

Is there a way to make this a calculation rather than a script? For example. 2 fields, 1 titled variable that you type a number in. 1 titled graph that has the letter g multiple times in it. Is there a way for the graph field to automaticaly add the g as many times as the number typed in to the variable field?

Posted (edited)

"But Soren's solution IS a calculation"

"I have found ANOTHER way to do it"

Soren's solution is BETTER than mine, more elegant, but I used alternative approach, which might work for some other problems solving.

I used something known as recursive custom function.

First make a custom function (FM 8 and up only):

Name the function "AddChars"

Make one Function parameter named "number"

Than add calculation as it is here:

Let([

number = Substitute ( number ; number; number-1 ) ];

If (number ≥ 0;

"g" & ¶ & AddChars(number); ""))

Let me explain it a little, which explanation can work for any recursive function from now on.

Let part of the function establishes something as variable named "number" (it exists only for this custom function), which with every call of this cust. function will reduce the number from it's current value to one less than that.

Next part is the if statement.

What that does is checking the value of "number" variable (less one from the "let" function), and if grater than 0, add one "g" to a field (in our case field named "bar"), but the essential part is what come next and that is the "&" sign and call for the same function "AddChars". This makes it "recursive" function. What this does is that it loops the function, reduces the "number" to one less every time until it's zero, and adds a new "g" to the "bar" field with every loop. Neat, isn't it?

For example:

Your db has two fields "count" and "bar" (bar's font is webding, and count is any viewable font: arial)

Set "bar" field as "Calculation" "unstored, calc when needed" -- "text" -- ="AddChars ( number )"

and yu are done

When you enter 5 in your count field, the calc does the following.

Checks if "number" parameter is >=0 and if not adds one "g" and calls the function again with number parmeter one less than before "4", checks for zero value and adds another "g" and so on until it gets to zero when it ends the loop.

Edited by Guest
Wring statements made in original posting.
Posted

I am not sure what you mean by "protectors". Should I be insulted?

I think most of us here strive to provide the best solutions for the problems presented. In this sense, we do protect the questioners from other, less optimal solutions.

Posted (edited)

You found it 'insulting in a way' that Comment said our focus is to protect those who post here? Ah, relax, he'd protect you in the same way. :smirk:

Comment pointed out that Soren's calculation does exactly what was requested. Simple. Everyone is free to disagree and even re-point someone to a prior post if they think it was missed. I don't think recursive CF is the best solution in this instance but that doesn't mean I'm insulting you either; in fact, I'm glad you posted it anyway. But having a difference of opinion is not insulting behavior; by either of you. There is nothing insulting in disageement but rather it is a privilege we all share.

However, Pavle, you went past that point with "Should I be rude as you" and "...should I go as low as you." Those are personal attacks and not accepted on FM Forums. Relax and have fun here ... nobody is putting you down for posting. None of us would do that, even if we might disagree at times. :wink2:

LaRetta

Edited by Guest
Edited
Posted

I did read the entire thread before posting.

If your reply to Heathbo would have been "But Søren's solution IS a calculation", or even "I have found ANOTHER way to do it", I wouldn't post. As it stands, it gives the impression you are providing a calculated alternative to Søren's scripted one.

If you feel that correcting such impression is insulting to you, that is regrettable - but I still believe the correction was warranted.

Posted

LaRetta,

thanks for the advices. I never said Soren's solution is wrong or mine is better than his. My apologizes if I lead readers to think that.

Comment, I probably step over the line, but I saw your post insulting in a way, as I said. My apologies to you, too.

Please, be sure to look the edits I made in my post.

Thank you.

Posted

To be honest I like both solutions. They both taught me something I didn't know before. I feel that's the purpose of this great community. Whether we like the feedback we recieve or not, we all learn and grow from it.

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