locked
BizTalk xs:date Data Type of schema RRS feed

  • Question

  • Hello to All!

    I am receiving a file and one of the values in the file is date with this type dd/mm/yyyy (22/10/2011) and I have to store this in CRM Date And Time field. I search and read many answers about this but non of them is similar to mine, please help. In the schema element I am giving the Data Type of the element as xs:date and Custom Date/Time Format as dd/MM/yyyy. In this case it can take and store the data successfully in the CRM side, but when my receiving file have no the data in that field it is giving an error in the receiving pipeline (even message doesn't goes to Orchestration)Reason: The Date or Time value received for Field: FirmName is incorrect.  Error: String was not recognized as a valid DateTime. 

    There are records which have the value in that field and there are records which don't have, so what can I do which will not give an error when data is empty in that element?I sow there is an option in the element properties Nillable  which I set to True, but still i get the same error.

    How can I ignore the validation when the element value is empty? Thnaks!

    Wednesday, October 25, 2017 12:10 PM

Answers

  • Thanks for help, but I found the way.

    Besides of setting Nillable of the element to True, we have to Set Min Occurs to 0, and in this case it will not throw an error if the element will be empty.

    • Marked as answer by Rem Odabashyan Wednesday, October 25, 2017 1:23 PM
    Wednesday, October 25, 2017 1:23 PM

All replies

  • Hi Rem,

    Is the schema element nillable? If so, null could be sent, or the element could be omitted and not sent at all.

    I guess you're receiving the element with an empty value today, e.g.

    <DateElement></DateElement>

    ?

    Br

    Leo


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Wednesday, October 25, 2017 12:27 PM
  • Hi Rem,

    Is the schema element nillable? If so, null could be sent, or the element could be omitted and not sent at all.

    I guess you're receiving the element with an empty value today, e.g.

    <DateElement></DateElement>

    ?

    Br

    Leo


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    yes the schema element Nillable is set to true, but it is giving error when I pass the empty element or even null in the element.In my case I am receiving  flat-file (csv), so I send this kind of file: 

    AdviserID,Married,Email,FirstName,LastName,DOB
    4000008001,false,JohnBrown@rambler.ru,John,Smith,10/10/2011  (in this record it have Date of Birth)
    4000008777,true,LeeSung@mail.ru,Lee,Sung,        (in this record DOB is coming empty)

    My Schema is Allowing Message Break, so in this case I will have 2 messages (one with DOB value, the other with empty value), but it is giving error without even breaking messages, but if I receive file with multiple records which where all have DOB element filled, it will successfully store all records with their values in CRM.

    Wednesday, October 25, 2017 12:40 PM
  • Hi,

    Can you make the date field as string and in mapper convert the string to datetime utc .This way you can have control over null and the actual data you are sending to downstream system.

     


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Wednesday, October 25, 2017 12:55 PM
  • Hi,

    Can you make the date field as string and in mapper convert the string to datetime utc .This way you can have control over null and the actual data you are sending to downstream system.

     


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    I tried to do like this too, but in this case my XSLT in the mapping side is not working correctly and it is giving an error while trying to convert to xs:dateTime.

    Here is my XSLT code in the Scripting functoid which is writeing/Updateing the Data field in CRM:

    <!-- DATETIME DATATYPE-->
    
    <b:KeyValuePairOfstringanyType>
         <c:key>new_birthday</c:key>
          <xsl:choose>
          <xsl:when test ="$DOB">
           <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">
           <xsl:value-of select="$DOB"/>
           </c:value>
           </xsl:when>
          <xsl:otherwise>
         <c:value i:nil="true"/>
         </xsl:otherwise>
         </xsl:choose>
    </b:KeyValuePairOfstringanyType>

    How can I convert dd/mm/yyyy incoming string type to appropriate date type which will work correctly with this XSLT?

    Thanks!

    Wednesday, October 25, 2017 1:10 PM
  • Thanks for help, but I found the way.

    Besides of setting Nillable of the element to True, we have to Set Min Occurs to 0, and in this case it will not throw an error if the element will be empty.

    • Marked as answer by Rem Odabashyan Wednesday, October 25, 2017 1:23 PM
    Wednesday, October 25, 2017 1:23 PM
  • Hi,

    Can you make the date field as string and in mapper convert the string to datetime utc .This way you can have control over null and the actual data you are sending to downstream system.

     


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    I tried to do like this too, but in this case my XSLT in the mapping side is not working correctly and it is giving an error while trying to convert to xs:dateTime.

    Here is my XSLT code in the Scripting functoid which is writeing/Updateing the Data field in CRM:

    <!-- DATETIME DATATYPE-->
    
    <b:KeyValuePairOfstringanyType>
         <c:key>new_birthday</c:key>
          <xsl:choose>
          <xsl:when test ="$DOB">
           <c:value i:type="d:dateTime" xmlns:d="http://www.w3.org/2001/XMLSchema">
           <xsl:value-of select="$DOB"/>
           </c:value>
           </xsl:when>
          <xsl:otherwise>
         <c:value i:nil="true"/>
         </xsl:otherwise>
         </xsl:choose>
    </b:KeyValuePairOfstringanyType>

    How can I convert dd/mm/yyyy incoming string type to appropriate date type which will work correctly with this XSLT?

    Thanks!

    Rem,

    Have the element type string and convert using s C# script functoid. 


    My Technet Articles

    If you like this or another reply, vote it up!
    If you think this or another reply answers the original question, mark it or propose it as an answer.


    Mauricio Feijo
    www.mauriciofeijo.com

    Wednesday, October 25, 2017 1:25 PM