qrules Date diff - change xpath to a field value which can change. - InfoPath Dev
in

InfoPath Dev

qrules Date diff - change xpath to a field value which can change.

Last post 07-24-2013 07:55 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-23-2013 03:41 PM

    qrules Date diff - change xpath to a field value which can change.

    Hi ,

    Can I replace the x-path portion to the "concat("DateDiff /date1=", my:EndDate, " /date2=", my:startDate, " /component=weekdays /dsnamehol=AustralianHolidays /xpathhol=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Date_x0028_dd_x002f_mm_x002f_yyy")"

    that is

    xpathhol=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Date_x0028_dd_x002f_mm_x002f_yyy

    with

    xpathhol= my:DateColumn

    where

    my:DateColumn is a field that holds the xpath of filtered columns in a list of dates.

    If I create a list of dates and other columns that have dates for different States then each xpath will be different.

    So when a state is chosen it takes the stored xpath value for that column representing the state and it becomes my:DateColumn which the DateDiff uses?

    Thank you.

    Best Regards
    Bill
  • 07-23-2013 04:45 PM In reply to

    Re: qrules Date diff - change xpath to a field value which can change.

    Hi Bill,

    Yes, you may want to use the fully qualified /my:<root>/.../my:StateDates[filter]/my:DateColumn where the <root> is the default myFields replacement and ... is the intervening path, and the my:StateDates is the parent repeating group and the [filter] is the State filter, for example [my:State=<foo>] where foo is the currently selected one in the main data source form (replace with a field).

    If you do that, you can get rid of the /dsnamehol=AustralianHolidays

    Send us your XSN and we can take a gander.

    Best,

    P

    Patrick Halstead
    Project Manager at Qdabra
  • 07-23-2013 05:19 PM In reply to

    Re: qrules Date diff - change xpath to a field value which can change.

    Hi Patrick,

    Thank you.

    I will send the xsn - very much appreciated.

    Kind Regards

    Best Regards
    Bill
  • 07-24-2013 07:55 AM In reply to

    Re: qrules Date diff - change xpath to a field value which can change.

    Hi Bill,

     

                    I’ve had a look at your form and the Excel file you provided us, and I believe I have a DateDiff formula that will work in your case:

     

    concat("DateDiff /date1=", my:EndDate, " /date2=", my:startDate, " /component=weekdays /dsnamehol=AustralianHolidays /xpathhol=/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/*[local-name() = '", ../my:Australia_State/my:State, "' and normalize-space()]")

     

          What this does is that it only selects non-blank holidays from the column with the same name as the form’s currently selected state. For example, *[local-name() = ‘NSW’] (in the case that my:State is NSW) will select elements from the data source with the name d:NSW, and normalize-space() is a way of checking that a field is non-blank, excluding spaces.

     

                    Could you give this formula a try and let us know if it works?

    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.