To open any link in a new tab, preserving your position in the current article, just hold down the <CTRL> key on your keyboard before clicking the link or click using your mouse wheel.

GetJobTotal

GetJobTotal



Retrieves the total number of items of a certain type in the entire opened job.



Syntax:

Procedure: GetJobTotal(const Propertyname: WideString; const ItemType: WideString = ''): Double;

Code Reference:

    1. Create a New Form application
    2. Add a button to the form
    3. Add PlanSwift to reference (Planswift9_tlb in the uses)
    4. Copy code to button onclick event


API Call

Delphi

Using PlanSwift Object Model
// PlanSwift:
var
  nTotalCount: double;
  sPropertyname: string;
  sItemType: string;
begin
  nTotalCount := PlanSwift.GetJobTotal(sPropertyname, sItemType);
end;

//FreshDesk:
procedure TForm1.psGetJobTotal(Sender: TObject);
var
  ps: IPlanSwift;
  est: IItem;
  folder: IItem;
  i: Integer;
  itm: IItem;
  CostEachTotal,QtyTotal: Extended;
begin
//Create the Planswift Interface
  ps := coPlanswift.Create;
//Begin Update Procedure
  ps.BeginUpdate;
//Get the Takeoff item (Estimating Tab in Planswift)
  est := ps.GetItem('Job\Takeoff');
//Create a New Folder in Estimating
  folder := est.NewItem('Folder','Material Items');
// Add 20 Material Part Items to the folder
  for i := 0 to 20 - 1 do begin
    itm := folder.NewItem('Material','Job Total Demo Material ' + intToStr(i));
//Set their Qty and Cost Each
    itm.SetPropertyFormula('Qty','20');
    itm.SetPropertyFormula('Cost Each','1.50');
  end;
//get Cost Each Total
  CostEachTotal := ps.GetJobTotal('Cost Each','Material');
//get Qty Total
  QtyTotal := ps.GetJobTotal('Qty','Material');
//Show the values
  ShowMessage('Qty Total: ' + FloatToStr(QtyTotal) + ' Cost Each Total: ' + FloatToStr(CostEachTotal));
//End Update Procedure
  ps.EndUpdate;
//Free Planswift
  ps := nil;
end;


C#

Using IItem Object Model
public class PlanswiftApi
{
    private PlanSwift Planswift { get; }
    public PlanSwiftApi()
    {
        Planswift = new PlanSwift();
    }
}
Using PlanSwift Object Model
Coming soon


VB/VBA (OLE)

Using IItem Object Model
Coming soon
Using PlanSwift Object Model
Coming soon


Copyright 2023 ConstructConnect