Ultra New to Infopath - Calculated Angle as decimal need to use Absolute value - and others. - InfoPath Dev
in

InfoPath Dev

Ultra New to Infopath - Calculated Angle as decimal need to use Absolute value - and others.

Last post 04-02-2012 07:51 PM by wapfunz. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-02-2012 04:31 PM

    Ultra New to Infopath - Calculated Angle as decimal need to use Absolute value - and others.

    1) I have three fields that are used to calculate an angle of a conveyor.

    Given infopath doesn't have any inbuilt functions for trig, I do in two parts. Infeed_Height - Outfeed_Height, then that answer divided by the length and use the decimal result.

    For positive decimal angles I can get conditional formatting and validation.

    When the decimal angle turns negative, there is no conditionals that will allow this so I need absolute value.

    If I could make the decimal angle have a degree value - wonderful.

    2) Can I use the VB trig functions and if so how do I call up?

    3) can I use VBA absolute fuvtion - and if so how.

    4) where do you start / how do you start say writing an event in vba in Infopath. I figure infopath uses visual studio - that use declarations etc - how do i declare vba functions

    Like in the above I wish to check the value of the calculated field and use the absolute value if I cannot change the decimal to a trigonometric value in degrees.

    If the calculated value is <= 0.194 (11 Degrees - tan) value is Ok

    If value is >0.194 but <0.249 (14 degrees) optional

    Value is greater > 0.249 not allowed

    Negative values are ok but follow same rules but they are negative

    So where do I start with the code? - an example would be great if it can be done.

    How to start VB code in infopath for dumbies like me would be great.

    Thank you in advance for any consideration of an answer and help.

    Best Regards
    Bill
  • 04-02-2012 07:20 PM In reply to

    Re: Ultra New to Infopath - Calculated Angle as decimal need to use Absolute value - and others.

    Hello wapfunz,

    It should be possible to get conditional formatting to work with negative values, but there is an XPath trick you can use to get the absolute value of something without any code.  The formula looks like this:

    value * (1 - 2 * (value < 0))

    VBA isn't available for coding in InfoPath.  The languages supported in the newest version of InfoPath are C# and VB.NET, though we don't usually recommend using code unless you're an experienced coder (and even then we recommend avoiding it if you can).

    Would you happen to be using InfoPath 2010 and SharePoint 2010?  If so, I believe it may be possible to use the Excel REST services to access Excel's trig functions, though I would have to check on that.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 04-02-2012 07:51 PM In reply to

    Re: Ultra New to Infopath - Calculated Angle as decimal need to use Absolute value - and others.

    Hello Jimmy,

    Thank you for your valued response.

    Using Infopath 2010.

    The idea is to publish the form to a sharepoint portal in the future which will be sharepoint 2010.

    So VBA out VB.net in mmmmmmmmmmmmmmmmmmmm - I do not want to try code for this as most code I have writen has been on a need to do or know basis, and coding etc is not my profession or vocation.

    Keeping things as simple as possible using the inbuilt features is where I wish to be.

     Best Regards

    Bill

    Best Regards
    Bill
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.