PdcTimeItemList.Add

From External Bemet Wiki
Jump to navigation Jump to search

Declaration

Add(ID as long) as PdcTimeItem

Description

Returns a new added timeitem object

Notes

This method add a timeitem object to the timeitem list. The input parameter is the "Master Data" ID in the table BWPLTIJD. In the operationcard on the tab Transactions the ID is shown.

Code example

This code add timeitem ID 155 to the list and add a total time of 4 x 0.5 = 2 units to the operation. The code runs on condition that a calculation is opened and a operation is selected.

dim objCalc
dim objBWPL
dim objTimeItem

  set objCalc = pdc.ActiveCalculation
  set objBWPL = pdc.ActiveCalculation.ActiveOperation
  set objTimeItem = objBWPL.TimeItems.Add(Trim(155))
  if IsValid(objTimeItem) then
    objTimeItem.Description = objTimeItem.Description & " (*)"
    objTimeItem.Quantity = 2
    objTimeItem.Rate = 0.5
  else
    msgbox "The timeitem isn't added to the list because:" & vbCrLf & _
           "1. This ID doesn't exist in BWPLTIJD." & vbCrLf & _
           "2. This ID already exist in the timeitem list." & vbCrLf & _
           "3. This ID belongs to another operation."
  end if
  objBWPL.Update  'Totalize the timeitems into the setup/cycletime or setup/piececosts
  objCalc.Refresh 'Refreshes the calculation on the screen

Availability

Available from version 3.0.