Mr. Chamberlain Posted December 31, 2007 Posted December 31, 2007 I am using a calculation to pull some data from repeating fields and enter the data into a text field. I am using the GetRepetition function in the calculation, however, the result that I get in the text box does not include the number formatting from the Repeating Field, such as the $ symbol, or comma to mark 1000's. Any help would be appreciated. Thanks.
Søren Dyhr Posted December 31, 2007 Posted December 31, 2007 It seems like the numbers should appear right in the middle of some prose, if so wouldn't I use GetRepetition( but instead use the bracket notation in merge-fields, because it then keeps the field as number, and you by it can keep the formatting. <> This grabs the 4th repetition! --sd
Mr. Chamberlain Posted December 31, 2007 Author Posted December 31, 2007 Thanks for your response. I understand the merge-field, but I am not sure how to use it in a calculation.
David Jondreau Posted December 31, 2007 Posted December 31, 2007 Formatting is generally field level, so if you're putting a number into a text field, it won't keep the number formatting. You can 1) Format the number via a calculation by adding the "$" in front of the GetRep and wrapping the GetRep in a calc that will give the comma in the right place and the correct number of decimals. It'll take some tweaking, but it can be done. 2) Use Soren's suggestion, which is useful if the result you want is for displaying on a layout only (not to use in further calculations or to e-mail, etc) where you use more than one calculation to assemble the text breaking the calc up where you want to insert the currency field and formatting that separately. 3) I haven't tested this , but if the currency fields are the only numbers in the calculation, I think you can drop the calc field as a merge field onto the layout and format the numbers that way.
Søren Dyhr Posted December 31, 2007 Posted December 31, 2007 I am not sure how to use it in a calculation. So the prose is an e-mail or such? If you accidentally have forgotten to update you profile, and now rides on a adv/dev licence, could you use this CF: http://edoshin.skeletonkey.com/formatting/index.html Perhaps Agnés could untangle the recusions?? --sd
The Shadow Posted December 31, 2007 Posted December 31, 2007 Also, if you upgrade to a more recent version, you can use GetLayoutObjectAttribute(; "content") to pull the number and its format information out of the layout object.
Søren Dyhr Posted December 31, 2007 Posted December 31, 2007 Oh yes! Much better indeed! "You owe me " & GetLayoutObjectAttribute ( "myRepeat";"content";4 ) & " - Please as soon as convenient!" --sd
comment Posted December 31, 2007 Posted December 31, 2007 That is very interesting. However, it does require the formatted field to be present on the current layout, which may not always be convenient. In such cases, it might be preferable to use a merged field or, if merging is not possible, a text calculation that formats the number as currency. Currency formatting in a text calculation has been disscussed many times, for example: http://www.fmforums.com/forum/showpost.php?post/257391/
The Shadow Posted December 31, 2007 Posted December 31, 2007 I was just pointing it out as an option. Pulling from an existing field object, (assuming it is already on the layout), has the advantage of following whatever formatting is on the original field, so if it is changed (eg, turn on red when negative), this calculation would automatically see that change too without having to modify some other mechanism to get the format to match up. Most field layout objects and merge field layout objects can respond to "source" and "content" in a meaningful way, and I thought it would be helpful to point that out also.
comment Posted December 31, 2007 Posted December 31, 2007 Oh, it's definitely an option well-worth exploring - and not just for number formatting. Thanks again for pointing it out.
Mr. Chamberlain Posted January 3, 2008 Author Posted January 3, 2008 Thanks for all of the responses - I've learned something from each of you. The Shadow's suggestion (GetLayoutObjectAttribute) was the easiest solution for me to implement and it worked perfectly.
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