Skip to Content

Setting UDO Field with subType st_Time through DI-API

Hello,

what is the correct format to set the value of a UDF of Type db_Date and SubType st_Time through the GeneralData Service.

When I call the GetValue Method it returns a String of this format:

#12/30/1899 05:00:00 PM#

Here is some example code to set the Value:

Dim oGeneralService As SAPbobsCOM.GeneralService = XXX.XXX.GetB1Connector().Company.GetCompanyService().GetGeneralService("TEST_UDO_OBJ")
Dim oGeneralData As SAPbobsCOM.GeneralData = CType(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData), SAPbobsCOM.GeneralData)
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams = CType(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams), SAPbobsCOM.GeneralDataParams)

' Get a specific udo record
oGeneralParams.SetProperty("Code", "0000001")
oGeneralData = oGeneralService.GetByParams(oGeneralParams)

' returns #12/30/1899 05:00:00 PM#
Dim testValueTime = oGeneralData.GetProperty("U_FIELD6")

oGeneralData.SetProperty("U_FIELD6", "800")

oGeneralService.Update(oGeneralData)

I always get an exception with the message:

Illegal value entered

I tried the following different formats for the value:

* "800"

* "08:00"

* "8:00"

* "#12/30/1899 05:00:00 PM#"

But everything failed with the specific message that the value is illegal. So what is the "legal" format to set an UDF value of SubType st_time in a UDO through the GeneralService?

Thanks in advance

Robert

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Nov 05, 2019 at 04:51 PM

    Hi Robert,

    it needs a DateTime value ( the time part ):

    oGeneralData.SetProperty("U_Time", DateTime.Now);

    regards,

    Maik

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.