Progress - InfoPath Dev
in

InfoPath Dev

Progress

Last post 01-12-2012 07:50 PM by kkendapa. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-05-2012 12:59 PM

    Progress

    something like percentage completed(assuming the the fields which are blank are not completed).

    What would be an good approach for this?

  • 01-05-2012 11:54 PM In reply to

    Well, this seems to be a pretty reliable formula for counting the total number leaf nodes (fields) in a form, assuming you don't have any childless groups in your data source:

       count((//*[not(*)] | //@*)[not(name() = "xml:lang")])

    And then this would count all the fields that have been filled in:

       count((//*[not(*)] | //@*)[not(name() = "xml:lang")][. != ''])

    If you divide the second one by the first one, that should give you the percentage of fields that have been completed.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-06-2012 12:36 AM In reply to

    That's pretty cool - you've created an approach that works for all forms. Very impressive use of xpath! :) 
    Patrick Halstead
    Project Manager at Qdabra
  • 01-06-2012 07:12 AM In reply to


  • 01-10-2012 09:12 AM In reply to

    Hi Jimmy

    I got it working for the individual views but the only issue I have now is I cannot count just the required fields. I tried data binding just required fields to a new group and counting it, that works but fails when the required field is in a repeating section or table it counts only the first row.

    Any help on how I could bind just the required fields from repeating table or section to a different group of fields which are data bound to the required fields in repeating table(or section)

     

  • 01-10-2012 12:51 PM In reply to

    The only solution I can think of (and it's not a very good one), is to prefix the name of the required fields with some special suffix like req_, and then you could use formulas like this:

       count((//*[not(*)] | //@*)[not(name() = "xml:lang")][starts-with(local-name(), 'req_')])

       count((//*[not(*)] | //@*)[not(name() = "xml:lang")][starts-with(local-name(), 'req_')][. != ''])

     This has the obvious drawback of giving you some somewhat unpleasant looking field names, and would make it hard to change which fields are and aren't required later (while still maintaining this design), so I would advise caution.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-10-2012 07:39 PM In reply to

    Can we use code to do it? Do you think that solution would work?
  • 01-11-2012 01:56 PM In reply to

    Hi Jimmy

    I have another issue here, when I do a count on particular node it gets me the correct values but if the node has child nodes its not counting them, can you please help me fix this. The way i'm doing it is

    count((nodepath/*[not(*)] | nodepath/@*)[not(name() = "xml:lang")]

    What should do to make it count its descendants.

    Thank You very much for the help so far.

  • 01-11-2012 10:55 PM In reply to

    I don't have a good answer for your required fields question.  There isn't a good way to determine whether a field is required or not.  For your latest question, please try adding two slashes after nodepath instead of just one.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-12-2012 07:50 PM In reply to

    Adding  an additional slash works great but now i'm facing with another problem, if I publish the form to libary with browser based I get this error "Required Fields of type xsd:base64Binary may not show validation errors correctly when the form is edited in a web browser. To fix this problem, add an xsd:minLength restriction to the field's schema". This error comes up only when I have the formula with additional slash, i went into xml and added the xs:minLength setting it to 3 or 4 but the error wont go away, any thoughts on this?

    Thank You

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