Setting Date in a Matrix
I have set a Current Date in a Matrix Column but its not displaying the current date. The code i used follows :-
oCriticalDB.SetValue("U_insdate", oCriticalDB.Offset, Date.Today)
Please tell what should i change in it.
Thanks in Advance.
Roland Toschek replied
it's again the old problem with the SDK-Var-Types.
Try with formatting your Date.Today to a String in "20081014"-Format: At the last parameter SetValue expects a String!
oCriticalDB.SetValue("U_insdate", oCriticalDB.Offset, "20081014")
For me the following rule has worked perfect in most (I would say nearly all) cases:
Have a look at the automatic help of .NET while typing a SDK-function:
If SDKs Get/Set-Value, ValueEx, Value etc... expect/return a string then format your value in - I call it - SDK-DB-format:
Price, quantity etc. => "1234.23" (this works for every language setting of B1 - also for germany where the dot normally is a comma
Date => "20081014"
If SDK expects/returns an object, then there's a good chance that you can use the .NET-Var-Type that you expect as a programmer:
Price, quantity etc. => Double
Date => DateTime )
I forgot: This only works when the field is DataBinded to a DataSource of the corresponding format!!
Is your U_insdate really a Date in DB?
Edited by: Roland Toschek on Oct 14, 2008 10:18 AM