Subscribe to the Technical Issues Web Feed

Subscribe here

Versions de produit supportées

Télécharger ce document (en anglais)

Pour connaître en détail les produits de Tango/04 et la date jusqu’à laquelle ces produits reçoivent le support et la maintenance de la part de nos experts.

Date type variables sent to database are converted into number type variables.

Version imprimableEnvoyer à un ami

Number

333

Date

15 Septembre 2011

Product

ThinkServer

Question

Upon sending a date type variable to SmartConsole using the function SendMessageToSmartConsole(), the variable is written to the database as a number instead of a date.

Answer

Python is moderately type-checked. Implicit conversions are defined for numeric types. Despite the fact that a date type value is automatically converted to a numerical value, we can use Python casting when working with a date type value so that this conversion doesn´t take place. In light of the fact that a string is an invalid argument for a mathematical function expecting a number, we can convert the date type value into a string so that no undesired mathematical operation takes place when the variable is assigned by the script.

Workaround

This issue is easily solved by enclosing the date type value in quotes, for example, ¨11-11-2011¨.

Version which has solved the problem

Additional Documentation