Display Created Date in SharePoint and have a second field that adds 30 days and display that too. - InfoPath Dev
in

InfoPath Dev

Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

Last post 03-13-2012 08:35 AM by TxSteve. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-08-2012 06:31 AM

    Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    Either it's lack of coffee or a simple matter of not seeing the forest for the trees...(hopefully a very simple request)

    Scenario:
    I want a user to go to a SharePoint site, select new, open a form. Line 1: Created Date: (Thinking this would be empty or hidden because the created date is not active from the form submission) The +30 days box would be hidden or empty too. User would complete the form, press submit. Later, a user would be looking at the list, click on the SharePoint link for the new form. The form opens, the Created Date and +30 days box would be displayed.

    How can this be accomplished? (If there is a sample on this board somewhere that would be awesome)

     

    Thank you

  • 03-08-2012 09:22 AM In reply to

    Re: Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    Oh, and to expand upon what I've tried. I added two Expression boxes. One points to created column on my SharePoint list, the other points to the Expression box within the form. I know there is something about Expression boxes having limitations as they only display, not store data. Anyway, when I have the two boxes, I can open an existing form just fine and get the results I wanted. However, when I select NEW to create a NEW form it fails with the following error; The XSL transform for the View XSL failed. Function 'AddDays' did not return a vaulue, or it returned a value that cannot be converted to an XSL data type.  

  • 03-13-2012 07:55 AM In reply to

    Re: Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    Anyone? Allow me to rephrase... Maybe I've confused everyone :)

    I want to display the created date via a SharePoint form list and a second field that adds 30 days to the created date when a user is opening a form to edit fields. When I add these to the form and the user is trying to populate a form for the first time (new) the form fails to load with the following error; "The XSL transform for the View XSL failed. Function 'AddDays' did not return a value, or it returned a value that cannot be converted to an XSL data type." How can I display these when the user is in edit mode and not when completing the form for the first time?

  • 03-13-2012 08:05 AM In reply to

    Re: Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    Well, let's see. Created date is being returned from your SharePoint Library? Are you using IP 2010 / ShP 2010 or are you on 2007?

    If 2010, you can add a data connection to receive data from the library you are submitting the form to, and get data "for this item only". If the form is new, their would be no data returned. So your logic in your form could be based on whether there is a created date returned in this data connection - you can hide stuff, whatever you need to do.

    I'm wondering if your add days function is having issues because of the format of the date returned from ShP? Or if you are not verifying there is a created date before trying to add days? Set your form up so you can test your logic - show the fields you are using temporarily, see how ShP is returning the data - I'd imagine it is coming in as date time. You may need to use a substring before the "T" in that case - without experimenting, I'm just not sure.

    Hilary Stoupa

  • 03-13-2012 08:22 AM In reply to

    Re: Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    v.2007

    I don't think I'm verifying if the date exists. (Conditional Formatting I presume) I will try to work on that, also definately not using a substring. I can try that too. Great tips!.

  • 03-13-2012 08:35 AM In reply to

    Re: Display Created Date in SharePoint and have a second field that adds 30 days and display that too.

    That was it! Just needed a little push in the right direction. :)

    First I added a repeating section. Inside, I added an expression box and linked it to the SharePoint form list, Created column. I then created a condition that says, Created is not present - Hide this control. Then I moved to the next field. I added an expression box with the adddays function AddDays(@Created, 30) and gave it a condition of  Created is not present - Hide this control. Appears to be working!

     Oh, and the first created box I gave the following source;  concat(substring(@Created, 6, 2), "/", substring(@Created, 9, 2), "/", substring(@Created, 1, 4))  Doing this gave me a date of 03/04/1965. The second expression box I simply selected Date and the canned format of 03/14/2001 so that they would match.

     

    Hope this helps someone too!

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