Currency related question - InfoPath Dev
in

InfoPath Dev

Currency related question

Last post 02-03-2013 08:48 PM by Jimmy. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 03-12-2012 10:04 AM

    • sjain
    • Not Ranked
    • Joined on 12-20-2011
    • Posts 7

    Currency related question

    Hello:

     I have an IP 2010 form with text boxes of datatype "double". Under Format, I select currency symbol ($ English United States), decimal places as "Auto" and digit grouping symbol is checked. This works fine as far as displaying the amount is concerned in that text box ($1,200). But, that is not how it is stored internally which causes me a problem when i have to take this value and insert it elsewhere in the form as the digit grouping symbol is gone. This used to work in my IP 2007 form, but, doesn't in IP 2010.

    Is there a way to get this grouping? There is no code and the amount can be in the thousands to a million or more.

     Thanks

  • 03-13-2012 09:05 AM In reply to

    Re: Currency related question

    Hi there,

    I don't believe the behavior has changed between 2007 and 2010, so that strikes me as bizarre why your form would break all of a sudden.  InfoPath will store the raw data in the XML and rely on data formatting to display the value as a currency which has been the model since its conception.  What is your scenario for why you want to store the grouping symbol?  Can you use display formatting on controls to solve your problem?  You mentioned taking the value and inserting it elsewhere on your form.  Perhaps you can elaborate on what you're trying to do and how its currently breaking for you.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 03-14-2012 09:04 AM In reply to

    • sjain
    • Not Ranked
    • Joined on 12-20-2011
    • Posts 7

    Re: Currency related question

    Hello :

    Thanks for your response. This is what I have and am trying to do.

     I have a single line text box(lets call it textbox1) with data type ="Double", formatting set to "currency ($ US English)", "Digit Grouping Symbol" checkbox checked. When I enter a value in this textbox (say 1234), the value displayed in this textbox (textbox1) as $1,234.

    However, when I want to use the value from textbox1 and put it in some other textbox, I loose the "$" sign as well as the "," and i get "1234". I can get around the "$" sign, but, putting commas is the issue I am having.

     Hope this clarifies the issue I am having.

    Thanks for  your response in advance.

  • 03-14-2012 11:34 AM In reply to

    Re: Currency related question

    Thanks for clarifying your issue.  I think what you're looking for is actually pretty simple.  On the second textbox, just set the formatting of the control to display with a currency symbol and use the comma separator.  Go to the control properties, click Format in the Data tab (the control probably needs to be bound to a double field) and select the setting you want in there.  Hopefully that will do the trick for you.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 03-14-2012 12:35 PM In reply to

    • sjain
    • Not Ranked
    • Joined on 12-20-2011
    • Posts 7

    Re: Currency related question

    Hello:

    Thank you for your response. I think what I should have also added to my scenario is that my second textbox is of type string as i am appending text in this second textbox along with this dollar value. So, your solution will not work for me.

    Thanks for any help/guidance that you can provide for this.

  • 03-14-2012 01:30 PM In reply to

    Re: Currency related question

    You can use the format-number function like this: format-number(field1, "$###,###").  Then you can just append the additional text that you want.  Just to warn you this function only works on the client and will not work in the server.  I'm not sure if there is an easy solution for the server.
    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 03-14-2012 02:57 PM In reply to

    • sjain
    • Not Ranked
    • Joined on 12-20-2011
    • Posts 7

    Re: Currency related question

    I don't see the format-number function in IP 2010 under rules.
  • 03-14-2012 04:01 PM In reply to

    Re: Currency related question

    It's not there.  You'll have to type it yourself.
    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 04-03-2012 10:58 AM In reply to

    • sjain
    • Not Ranked
    • Joined on 12-20-2011
    • Posts 7

    Re: Currency related question

    I tried this. This is what I put in the rules for my textbox control.

     concat(substring-before(EstimatedFeesAndExpensesTxt, "[[EstimatedFee]]"), format-number(FeeAmount,"###,###"), substring-after(EstimatedFeesAndExpensesTxt, "[[EstimatedFee]]"))

    When I click on Verify Formula, it returns no errors and works as expected when I preview the form. But, when I publish the form, I get an error stating "unknown expression". If I still select "Publish Anyway", the form is not wbe enabled and instead opens in infopath filler.

    Where am I making a mistake. Please help! 

  • 04-03-2012 01:16 PM In reply to

    Re: Currency related question

    I believe this function only works on the client, so that won't be a good solution for you :(
    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 02-01-2013 04:15 AM In reply to

    Re: Currency related question

    I see that this is an old post, but does any one have a great idea or a great answer?
  • 02-03-2013 08:48 PM In reply to

    Re: Currency related question

    I don't have a great idea, or a great answer, but I have something that should work. How large are the numbers you're working with?

    You can use a bunch of rules:

    Condition: value >= 1000000000

    Action: set field: concat('$', floor(value div 1000000000), ',', floor(value mod 1000000000 div 1000000), ',', floor(value mod 1000000 div 1000), ',', floor(value mod 1000))

    Condition: value >= 1000000 and value < 1000000000

    Action: set field: concat('$', floor(value div 1000000), ',', floor(value mod 1000000 div 1000), ',', floor(value mod 1000))

    Condition: value >= 1000 and value < 1000000

    Action: set field: concat('$', floor(value div 1000), ',', floor(value mod 1000))

    Condition: value < 1000

    Action: set field: concat('$', floor(value))

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.