XSLT to Get number of Day since the beginning of the year - InfoPath Dev
in

InfoPath Dev

XSLT to Get number of Day since the beginning of the year

Last post 10-07-2010 08:17 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-05-2010 06:41 AM

    XSLT to Get number of Day since the beginning of the year

    Could someone tell me how to get the number of the day in the year (not the month) using xslt. i cannot use code behind. So if passed February 1 the transform would return 32

    Any ideas? Can this be done without code behind?

    Love them ALL...regardless.
  • 10-05-2010 10:56 PM In reply to

    Re: XSLT to Get number of Day since the beginning of the year

    Hi KC,

    There is a reference to the w3c site that has the XML references - on the main InfoPathDev page click resources in the right hand side and explore that area. You'll find it. Custom xpath functions is not going to work here. You need qRule's date diff function. It's a piece of cake. Just install the free trial, inject it in your form and open the user guide and search for DateDiff. Add a rule that set's the qRules command to that and pass in the path for the field you want to calculate too. This will work for any leap year etc. 

    Otherwise, I recommend searching around. I seem to recall a guy in Europe that had a method for doing stuff in xpath but it was pretty convoluted. Nowadays we just use qRules for this.

    Disclaimer: Qdabra Software sells qRules for $199 to help defray the cost of supporting this free forum. Your purchase not only helps you get your work done quickly - qRules comes with the top 40 most commonly requested features in InfoPath and you can use it in all of your forms (dev license not client license), but you will feel good about supporting this forum. qRules is very inexpensive and we do offer big discounts for people who send us a 2-3 sentence testimonial and their picture.

    Happy trails!

    Patrick Halstead
    Project Manager at Qdabra
  • 10-07-2010 06:11 AM In reply to

    Re: XSLT to Get number of Day since the beginning of the year

    HI Patrick,

    qRule sounds like a great add-in. But I work in a highly secure facility and getting third party software approved for use can take months. If qRules is only installed on my developer machine and can work across the enterprise without having to be installed on every client I may be able to get approved more quickly. Thanks for the heads up.

    Love them ALL...regardless.
  • 10-07-2010 08:17 AM In reply to

    Re: XSLT to Get number of Day since the beginning of the year

    Hello KansasCoder,

    qRules isessentially a DLL that gets embedded into your InfoPath form templates (XSNs), the same way that InfoPath embeds a compiled DLL into your form templates if you write your own managed code for them.  This design allows you to use qRules to perform operations on your form's data sources and other techniques during your forms' runtime, that are usually impossible to do without writing your own code.  By definition, this means that qRules' code runs on client machines as they are using your forms, but here are a few points that might put your mind at ease a bit:

    • qRules does not need to be installed on client machines or on your server for your users to take advantage of it.  It's included in your form templates so your users automatically get its functionality when they open up your forms in InfoPath.
    • qRules can run in InfoPath's domain level trust mode, which you can read about here.  This means that it is prohibited from accessing users' local system resources or sending network requests to addresses outside your users' trusted sites.
    • InfoPath provides a good deal of sandboxing for the managed code that it runs, which means you can rest fully assured that it's not possible for qRules cause your users' programs to crash, or hog their system resources.

     

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