cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Date in a Matrix

Former Member
0 Kudos

Hi All,

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.

Regards,

Madhavi.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

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

Former Member
0 Kudos

Hi Roland,

I tried in the way u said and checked the Data Type too it is in Date only i bind it with Datasource but its not displaying the current date in the matrix. What should i do for that?. The code i tried:-

oCriticalDB.SetValue("U_insdate", oCriticalDB.Offset, Format(Date.Today, "yyyymmdd"))

Madhavi.

Former Member
0 Kudos

Then try the following for setting the date-value:

MtxRow is the MatrixRow-No where you want to set the date (1-based)

oMtx is the matrix

oCriticalDB.Offset = MtxRow-1

oCriticalDB.SetValue("U_insdate", MtxRow-1, Format(Date.Today, "yyyymmdd"))

oMtx.SetLineData(MtxRow)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

madhavi

oedit=oMatrix.Columns.item("x").cells.item(y).specific

oedit.String = Date.Today.ToString("dd/mm/yyyy")

give loop this code under matrix visible row loop

regards

varma

Former Member
0 Kudos

Hi Varma,

I tried like the code you gave but still its not displaying the date.

Madhavi