Syntax

code

Property: IPropertyObject.Expression: Boolean;


Description

Gets or Sets the Expression attribute for the property.


Code Reference


code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

var

  ps: IPlanSwift;             

  itm: IItem;

  prop: IPropertyObject;

  est: IItem                

begin

 //Create planswift Interface

    ps := coplanswift.Create;

    //Get the Estimating Tab

    est := ps.Getitem('Job\Takeoff');

    //get Ps Property Example Item if exists

    itm := est.GetItem('PS Property Examples');

    //Delete It

    if not varisclear(itm) then begin             

      ps.deleteItem(itm.guid);    

    end;

    //Create a new Item

    itm := est.newItem('Part','PS Property Examples');

 

   //EXPRESSION EXAMPLE

    //Write Expres

    expr := 'if ([qty] < 0) then Result := ' + chr(39)+ 'Qty value not zero' + chr(39);

    expr := expr + 'else Result := ' + chr(39) + 'Qty value is zero' + chr(39);

    //Create a new Property and set formula to the exp above

    prop := itm.NewProperty('EXPRES Example',expr,ptText);

    //Set its Expres To True

    prop.Expression := true;                   

    //Set to API Group

    prop.Group := 'API EXAMPLES';

     

    //Show The Item Properties Box

    itm.Edit(true);

    //Free the planswift interface

    ps := nil;

end;