Rules - problem with condition in parsed date field - InfoPath Dev
in

InfoPath Dev

Rules - problem with condition in parsed date field

Last post 06-20-2011 09:46 AM by dms.WebDev. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-20-2011 08:28 AM

    Rules - problem with condition in parsed date field

    Using IP 2007 published to MOSS 2007 form library.

    I have 4 hidden fields with functions to parse the date from the "NameCode" field.  I am using the Year and Month values to promote as columns so I can sort the form libary by year then month.  The problem* is with field4 "MonthText".  I would like to convert the month from a number to a name but the Rule I've applied is not doing the trick.  I've applied it on the field4 "MonthText" field. All 4 fields are text data types. 

    field1 "NameCode" = string(now()) 

    field2 "Year" = substring-before(NameCode, "-")

    field3 "MonthNumber" = substring(NameCode, 6, 2)

    *field4 "MonthText" = Rule1 If "MonthNumber" is equal to "01" set a fields value "MonthText" to "Janaury" and so on for the remaining months...

    What is wrong with my rule, why isn't it showing up?

     

     

  • 06-20-2011 08:34 AM In reply to

    Re: Rules - problem with condition in parsed date field

    Where have you placed the rules you are talking about for field4?  They should probably be placed on the MonthNumber field.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-20-2011 08:41 AM In reply to

    Re: Rules - problem with condition in parsed date field

    I placed them on field4 ("MonthText").

    Thank you for your solution. It appears if I place the rules on field3 instead, they show up!

     

     

  • 06-20-2011 09:46 AM In reply to

    Re: Rules - problem with condition in parsed date field

    UPDATE to my last response - I was WRONG.  Adding the rules to field3 did not solve the problem nor does it seem to make a difference whether the checkbox for "Stop processing rules when this rule finishes" is checked or not checked.  The ONLY time the rule works is the first time a new form is submitted after the form is first published.  Subsequent new forms do not show the month.  The Year and Month Number show up, but the Month Text does not show up.  The Month Text is set by rules.  I have applied them to MonthNumber and MonthText and tried numerous combinations of check/uncheck the "Stop processing...." checkboxes and nothing seems to work.

     I am stumped.  Can anyone help???????????? 

    UPDATE2: after struggling with this for 2 days I found a better solution -- leaving InfoPath out of the equation entirely.  I solved this by creating two calculated columns Year & Month in my SharePoint form library using these formulas:
    Year   =TEXT(Created,"YYYY")

    Month =TEXT(MONTH(Created),"00")&" "&TEXT(Created,"mmmm")

    (Note I added the 2-digit numeric month to month name so month sorts correctly).

    The beauty of this method is that I don't have to relink existing forms to the newly revised InfoPath form template.  The calculated fields appear with their values immediately to all existing forms in the library once they are created.  All I wanted to do was group items in the list by year and month. I utilized the built-in SharePoint column "Created" to parse the year and month (instead of my InfoPath form name (string(now())).  As a newbie this is an awesome revelation! 

     

    Thanks goes to these two posts which helped me set it up:

    http://zabistop.blogspot.com/2008/01/calculated-column-to-display-month-name.html

    http://www.sharepointboris.net/2009/05/get-the-month-name-in-calculated-column/

     

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