cancel
Showing results for 
Search instead for 
Did you mean: 

format date in matrix column

Former Member
0 Kudos

Hi experts,

i need to format date in dd-mm-yyyy format on matrix column.

i'm using LoadFromDataSource() to save the data into matrix but i get the string 20091220 in matrix column data rather then 20-12-2009.

can anyone help me to achieve it?

thanks in advance.

Best regards

Andrea

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Andrea,

please set the SAP Business One Application the Date Format.

Path is : Goto Administration > System Initialization>General Settings> Under the Display TAB> Date Format.

Please let me know, it is working or not?

Regards

shiva

Former Member
0 Kudos

i solved the issue setting DisplayDesc attribute to false

Former Member
0 Kudos

Andrea,

You are GREAT, I have never thought that this will be the solution.

Regards

J.

Former Member
0 Kudos

Andrea,

You can format the date by SQL if you are loading the matrix from a custom Query.

Use Convert SQL function to set up the required format.

Regards,

János

Former Member
0 Kudos

János,

i don't use a custom query to load tha matrix.

here is my code:

Dim stoMt As Matrix = stoForm.Items.Item("Matrix_0").Specific

oDBDataSource = stoForm.DataSources.DBDataSources.Item("@TC_STO")

oCon.BracketOpenNum = 1

oCon.Alias = "U_CardCode"

oCon.Operation = BoConditionOperation.co_EQUAL

oCon.CondVal = cardCode.Value

oCon.BracketCloseNum = 1

oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND

oCon = oCons.Add

oCon.BracketOpenNum = 1

oCon.Alias = "U_LineId"

oCon.Operation = BoConditionOperation.co_EQUAL

oCon.CondVal = oLineId.Value

oCon.BracketCloseNum = 1

stoMt.Clear()

stoMt.AutoResizeColumns()

oDBDataSource.Query(oCons)

stoMt.LoadFromDataSource()

how can i do to apply the required format to matrix column data?

Former Member
0 Kudos

Hello Andrea,

I have tested, and if i define a Date type User Defined Field in a User Defined Table, and bindind it into an EditText Column of the Matrix the Date is displayed in correctly.

Your UDF is Date format or just Text Format?

This is a sample for OCRD (Non UDT)


 Dim oDBS As SAPbouiCOM.DBDataSource = oForm.DataSources.DBDataSources.Add("OCRD")
        oItem = oForm.Items.Add("80", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
        oItem.Top = 100
        oItem.Left = 5
        oItem.Width = 90
        oItem.Height = 90
        Dim oCons As New SAPbouiCOM.Conditions

        Dim oCon As SAPbouiCOM.Condition = oCons.Add()
        oCon.BracketOpenNum = 1
        oCon.Alias = "CardType"
        oCon.Operation = BoConditionOperation.co_EQUAL
        oCon.CondVal = "C"
        oCon.BracketCloseNum = 1

        oDBS.Query(oCons)
        Dim oMatrix As SAPbouiCOM.Matrix = oItem.Specific
        Dim oColumn As SAPbouiCOM.Column = oMatrix.Columns.Add("COL1", BoFormItemTypes.it_EDIT)

        oColumn.DataBind.SetBound(True, "OCRD", "CardCode")
        oColumn = oMatrix.Columns.Add("COL2", BoFormItemTypes.it_EDIT)
        oColumn.DataBind.SetBound(True, "OCRD", "CreateDate")
        oMatrix.LoadFromDataSource()

Regards,

János

Former Member
0 Kudos

below my xml form:

the UDF named U_DataDal is declared as Data type in the UDT @TC_STO

in the edit text matrix column i get the string "20092012"

what can i do?

Former Member
0 Kudos

Hello Andrea,

Set your computer regional settings (start / run / intl.cpl) the date format as same as SAP B1 has defined in the administration module. (delimiter also!)

Then restart the Development environment. Maybe this helps...

Regards,

János

Former Member
0 Kudos

Hi János,

I checked my regional setting are correct!

the date format is dd/mm/yyyy like sap b1

i don't know why i get the same db format string...yyyymmdd