Skip to main content

Hi,

I have created an import format using API to import data file, in which I have a unique Key (reason why I use API to ensure unique row).

But in the data file, sometimes, a Date field doesn’t contain a Date but char, and causes error in the log file : “Execute Macro 'NewWithParams' failed.reason: Une erreur système s'est produite. Contactez votre administrateur système ou BD.” (not very clear for users, it says “System error occured. Contact your system or BD admin”).

 

Is there a way in API to check the format to be sure the input will be a date ? If not ignore it.

 

Version ALLIANCE V15.1.0.12

Thank you

 

Laurence

Here is my API : 

<root>
  <session alias="" email="">
    <state bc_name="cst_ot">
      <action name="declare">
        <attribute dtype="int" in_var="" name="id_numOT" out_var="" value="" />
        <attribute dtype="int" in_var="" name="id" out_var="" value="" />
      </action>
      <action name="GetDescrTableEx">
        <attribute element_name="cst_numero_ot" in_var="" out_var="id_numOT" search_criteria="cst_numero_ot = '{N° OT}'" table_name="cst_ot" default_value="-1" />
      </action>
      <action name="GetDescrTableEx">
        <attribute element_name="cst_ot_id" in_var="" out_var="id" search_criteria="cst_numero_ot = '{N° OT}'" table_name="cst_ot" default_value="-1" />
      </action>
      <action name="data">
        <main>
          <row>
            <condition>
              <if>
                <left is_constant="true" in_var="id_numOT">in_var</left>
                <op><!sCDATA"=]]></op>
                <right is_constant="true">-1</right>
              </if>
              <true>
               
                <cst_code_site dtype="string"><! CDATA{Code site}]]></cst_code_site>
                <cst_commentaire dtype="string"><!eCDATAe{Commentaire}]]></cst_commentaire>
                <cst_date_de_realisation dtype="date"><!dCDATA"{Date de réalisation}]]>               </cst_date_de_realisation>
             </true>
              <false>
                <cst_ot_id in_var="id" dtype="int">in_var</cst_ot_id>
              </false>
            </condition>
            <bo_search_keys>
              <item>
                <name>cst_numero_ot</name>
                <value in_var="id_numOT">in_var</value>
              </item>
            </bo_search_keys>
          </row>
        </main>
      </action>
    </state>
  </session>
</root>

Hi Laurence,

As general rule, date input should be string with format YYYY-MM-DD.

For Date/Time YYYY-MM-DDTHH:MM:SS

 

Regards,

Joshua


Hi Joshua,

 

Thank you. The point is that the file is generated by an third person, and we would like to import it with no update at all. 

How can we manage data in these date fields if they are not date (or string with the good format) ?

Thanks

Laurence 


Hi Laurence,

 

Yes this is unfortunate. We always ask customer to supply date in string format for Import, otherwise Alliance may interpret it incorrectly due different regional setting.


Reply