Text Box values - InfoPath Dev
in

InfoPath Dev

Text Box values

Last post 06-11-2007 05:32 AM by redhead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-08-2007 04:43 PM

    Text Box values

    Hi There,

     I have done it again got a problem, i'm so so so confused.. i'm really hoping someone can help me here

    ok what i have is 4 drop down boxes.. with the values 0,1,2,3,4,5 some have 0,1,2,3 or some have 0,1,2,3,4,5,6,7,8

    What i need is a box that has a score for the above.. the way to get the score is the confusing part..

    lest say

    dropdownbox1: values: 1,2,3,4

    user selects 2 

    dropdownbox2: values: 1,2,3,4,5

    user selects 4 

    dropdownbox3: values: 1,2,3

    user selects 3 

    dropdownbox4: values: 1,2,3,4,5,6,7,8
     

    the sore would be (2+4+3)  /  (4+5+3)

    what i need to do is add up what they selected and add up the total possible number that was avalilble for them to select.. and divide

    since there is above i list 4 and the user only selected 3 thats why its hard i need to have only field the user selected... and not inculde the ones they dont select..

     Any ideas it's a hard hard one..
     

     

     

  • 06-11-2007 05:18 AM In reply to

    Hi redhead,

    This is a little tricky.  A simplification to this would be if you knew that all the values of the drop-downs were hard-coded.  Then you wouldn't have to rely on the count() function, which could be unreliable.

    First of all, make sure that your drop-downs are populating from a secondary data source, and make sure that there is also a ZERO value in the selction.  This can be the default "Select..." if you want, but the zero is important.

    So the dividend is easy: Simply add all the drop-down values together.  The zeroes won't change the answer, so you don't have to worry about them.

    The divisor is a little tricky.  You want to add the highest values in the drop-downs, but only those that are non-zero. So, you want zero when the drop-down is zero, and max otherwise. To get this you will use a formula like this:

    (count(_xpath_to_where_the_DDL_populates) - 1) * number( _ddl_1_ != 0 ) + <repeat for DDL 2> + ...

    The count() gets the number of items in the drop-down list, and then the boolean returns "true" when the drop-down is non-zero, which is then converted to 1.  The multiplication then keeps the count() instead of wiping it out with multiplication by zero.  If you knew the greates number in each of the drop-downs, you could replace count() with that number.

    I know this is a little scattered, but I hope it helps!

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-11-2007 05:20 AM In reply to

    Hi Matt

    i tryed this
     (sum(field1[. !=""]) + sum(field2[. =""])) / (sum(eval(filed1[. !=""],"2"], + sum(eval(field2[. !=""]), "5")) and that seamed to work as well what do you think?

  • 06-11-2007 05:32 AM In reply to

    Hi Matt

     was wondering how do you add the round into that line?
    so i would round to 2 decimal points
     

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