Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DeleteItem


...

Deletes the given item if it exists.

...

Procedure: PlanSwift.DeleteItem(const ItemPath: WideString): WordBool;


API Call:Calls

Delphi

Code Block
languagedelphi
themeRDark
firstline1
titleUsing PlanSwift Object Model
linenumberstrue
collapsetrue
// PlanSwift Code:
var
  sItemPath: string;
begin
  if(PlanSwift.DeleteItem(sItemPath) = TRUE) then
    begin
      // do something...
    end;
end;

// FreshDesk Code:

var  
ps: IPlanSwift;
  est: IItem;
  i: Integer;
  itm: IItem;
begin
  // Create Planswift Interface
  ps := coPlanswift.Create;
  // Get the Estimating Tab
  est := ps.GetItem('Job\Takeoff');
  // Loop through all items on the first level
  for i := est.ChildCount - 1 downto 0 do
  begin
    // Get the item at index i
    itm := est.ChildItem[i];
    // delete the item
    itm.Delete;
  end;
  // Free Planswift
  ps := nil;
end;


C#

Code Block
languagec#
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue
collapsetrue
public class PlanswiftApi
{
    private PlanSwift Planswift { get; }
    public PlanSwiftApi()
    {
        Planswift = new PlanSwift();
    }
}


Code Block
languagec#
themeRDark
firstline1
titleUsing PlanSwift Object Model
linenumberstrue
Coming soon


VB/VBA (OLE)

Code Block
languagevb
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue
collapsetrue
// PlanSwift Code:
AreYouSure := False;

If then
  Item.Delete;


// FreshDesk Code:
var  ps: IPlanSwift;
  est: IItem;
  i: Integer;
  itm: IItem;
begin
  // Create Planswift Interface
  ps := coPlanswift.Create;
  // Get the Estimating Tab
  est := ps.GetItem('Job\Takeoff');
  // Loop through all items on the first level
  for i := est.ChildCount - 1 downto 0 do
  begin
    // Get the item at index i
    itm := est.ChildItem[i];
    // delete the item
    itm.Delete;
  end;
  // Free Planswift
  ps := nil;
end;


Code Block
languagevb
firstline1
titleUsing PlanSwift Object Model
linenumberstrue
Coming soon