stann Posted August 3, 2004 Posted August 3, 2004 I have a field which contains a number."Number" I have a global in which I would like to translate that number into the number of times I display the letter x. So if the number field contains "7" I would like the global field to calculate this "xxxxxxx" So if the number field contains "13" I would like the global field to calculate this "xxxxxxxxxxxxx" Thanks Dave
QuinTech Posted August 3, 2004 Posted August 3, 2004 Hi, Dave. Try creating a second global field called Counter and then using this script: If [ "Number <= 0" ]
-Queue- Posted August 3, 2004 Posted August 3, 2004 Well, it would be a calculation field, since a global calculation won't auto-update the same way. Assuming you can have up to 100 in the number field, your calculation field would be Left( number, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ). Change the comma to a semi-colon for version 7. If using Developer, you could also create a Custom Function that would do it without hard-coding 100 or more xes.
-Queue- Posted August 3, 2004 Posted August 3, 2004 Jerry's script is more dynamic than my calculation. However, it will require users to click a button to update the field after 'number' is changed.
CobaltSky Posted August 3, 2004 Posted August 3, 2004 Hello Stann, Whether by script or by calculation, I suggest that you use the formula: Substitute(Right(10^Number, Number), "0", "x") - which will produce the desired number of 'x' characters for 'Number' values in the range from 0 to 214. If you need a range that goes beyond 214, a slightly more complex formula will be needed - but nothing that requires you to type a hundred Xs...
-Queue- Posted August 3, 2004 Posted August 3, 2004 Nice. I've never seen that one before. I thought it could be done, but never had need for it. Thanks, Ray.
CobaltSky Posted August 3, 2004 Posted August 3, 2004 Of course that is for FileMaker v6. For v7, I'd suggest using the following Custom Function: Extrapolate ( String; Number ) with the function definition being: Case( Number > 0; String & Extrapolate ( String; Number - 1 ) ) ...which will be good for value ranges of 'Number' from 0 to 9,999.
QuinTech Posted August 4, 2004 Posted August 4, 2004 I knew when i was writing my solution that there would be a better one... i didn't think that there would be TWO. J
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now