December 31, 200718 yr 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.
December 31, 200718 yr 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
December 31, 200718 yr Author Thanks for your response. I understand the merge-field, but I am not sure how to use it in a calculation.
December 31, 200718 yr 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.
December 31, 200718 yr 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
December 31, 200718 yr 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.
December 31, 200718 yr Oh yes! Much better indeed! "You owe me " & GetLayoutObjectAttribute ( "myRepeat";"content";4 ) & " - Please as soon as convenient!" --sd
December 31, 200718 yr 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/
December 31, 200718 yr 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.
December 31, 200718 yr Oh, it's definitely an option well-worth exploring - and not just for number formatting. Thanks again for pointing it out.
January 3, 200818 yr Author 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.
Create an account or sign in to comment