cancel
Showing results for 
Search instead for 
Did you mean: 

Add value for user defined table

Former Member
0 Kudos

how do i add value incremented by 1 for Code and Name in user defined table?

below is my script

  oUserTable = init.company.UserTables.Item("Table_Log");
        oUserTable.Code = "Value"; //incremented by 1
        oUserTable.Name = "Value"; //incremented by 1
        oUserTable.UserFields.Fields.Item("U_Message").Value = _ServicesStarted;
        oUserTable.UserFields.Fields.Item("isError").Value = "Y";
        oUserTable.UserFields.Fields.Item("Date").Value = DateTime.Now;
        oUserTable.Add();

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member183373
Active Participant
0 Kudos

Hello Assaf,

If you create your UDO as Document you will have DocEntry field which is incremented automatically. But if you use Master Data you have to enter the code manually like in the Item and Business Partner Master Data.

Otherwise you have to do it manually by reading the last number from the table.

Thanks,

Atilla

Former Member
0 Kudos

hi thanks for your reply

I have created a log table in UDTSi don t know if it s as Document or Master data

<row Name ="Table_LOG">
    <TableName>Table_LOG</TableName>
    <Descr>Error Log</Descr>
    <ObjectType>0</ObjectType>
    <Archivable>N</Archivable>
    <ArchivDate/>
  </row>

anyway i would like to do it manually by reading the last number from the table

can you please tell me how to do this?

Former Member
0 Kudos

One suggested to use recordset

create a recordset and and put query inside for selecting the last number +1 out of the table

how to do this

  var recset = init.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset) as SAPbobsCOM.Recordset;

            recset.DoQuery("");

former_member183373
Active Participant
0 Kudos

Hello Assaf,

Check the Recordset Object in the SDK Help file. The topic explains this pretty clear.

Thanks,

Atilla