Estimator Application‎ > ‎Tutorial‎ > ‎

44. How to work with the console

This chapter is for you if you love and are curious and interested in hacking on your own estimator application program to learn more about how it works (with the understanding that you'll need to fix anything you break).

With the console you can program your estimator application. You can define your own functions and execute programs you write. Lets have a look at it.

Select in the menu bar: System > Console.

For example type the next line in the console and press ENTER:
print("Hello world");

That was easy. Read on to learn more.

An other example:
print(estimator.p.getDescription(1));

We now try to load a small program that draws the sine function. Download graph.bsh and load it in the console. 
Select in the menu bar: File > Open. And open graph.bsh.

Click on the run button to execute the program.

We see the sine function displayed. Close the window with the sine function.


Detailed information about how to work with the console can be found on the following websites:


Estimator-API for the console
You need this to interact with estimator application.

Specification of a project
int        estimator.p.getNumber(int i)
String     estimator.p.getNumberString(int i)
String     estimator.p.getDescription(int i)
BigDecimal estimator.p.getQuantity(int i)
String     estimator.p.getUnit(int i)
BigDecimal estimator.p.getPrice(int i)
BigDecimal estimator.p.getTotal(int i)
String     estimator.p.getStatus(int i)
String     estimator.p.getNote(int i)
Workbook   estimator.p.getWb(int i)
boolean    estimator.p.isDeletable(int i)
BigDecimal estimator.p.total()
int        estimator.p.size()

Substantiation of a specification
Substantiation estimator.p.getSubstantiation(int i)
int            estimator.p.getSubstantiation(int i).getCostTypeNumber(int j)
String         estimator.p.getSubstantiation(int i).getDescription(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getPrice(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getUnits(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getProduction(int j)
String         estimator.p.getSubstantiation(int i).getCalculationType(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getQuantitiy(int j)
String         estimator.p.getSubstantiation(int i).getUnit(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getTotalPriceUnitsProduction(int j)
BigDecimal     estimator.p.getSubstantiation(int i).getTotal(int j)
int            estimator.p.getSubstantiation(int i).size()

Project cost type library of a project
CostTypeLibrary estimator.p.getCostTypeLibrary()
int             estimator.p.getCostTypeLibrary().getNumber(int i)
String          estimator.p.getCostTypeLibrary().getDescription(int i)
BigDecimal      estimator.p.getCostTypeLibrary().getPrice(int i)
String          estimator.p.getCostTypeLibrary().getUnit(int i)
int             estimator.p.getCostTypeLibrary().getCostGroupNumber(int i)
String          estimator.p.getCostTypeLibrary().costGroupDescription(int i)
boolean         estimator.p.getCostTypeLibrary().isActive(int i)
int             estimator.p.getCostTypeLibrary().size()

Project cost group library of a project
CostGroupLibrary estimator.p.getCostTypeLibrary().getCostGroupLibrary()
int              estimator.p.getCostGroupLibrary().getNumber(int i)
String           estimator.p.getCostGroupLibrary().getDescription(int i)
int              estimator.p.getCostGroupLibrary().size()

Default cost type library
CostTypeLibrary estimator.defaultCostTypeLib
int             estimator.defaultCostTypeLib.getNumber(int i)
String          estimator.defaultCostTypeLib.getDescription(int i)
BigDecimal      estimator.defaultCostTypeLib.getPrice(int i)
String          estimator.defaultCostTypeLib.getUnit(int i)
int             estimator.defaultCostTypeLib.getCostGroupNumber(int i)
String          estimator.defaultCostTypeLib.costGroupDescription(int i)
int             estimator.defaultCostTypeLib.size()

Default cost group library
CostGroupLibrary estimator.defaultCostTypeLib.getCostGroupLibrary().getCostGroupLibrary()
int              estimator.defaultCostTypeLib.getCostGroupLibrary().getNumber(int i)
String           estimator.defaultCostTypeLib.getCostGroupLibrary().getDescription(int i)
int              estimator.defaultCostTypeLib.getCostGroupLibrary().size()


Project data of project
ProjectData    estimator.p.getProjectData()
String         estimator.p.getProjectData().getContractNumber()
String         estimator.p.getProjectData().getDescription()
String         estimator.p.getProjectData().getClient()
String         estimator.p.getProjectData().getContractor()
String         estimator.p.getProjectData().getContractor_city()
String         estimator.p.getProjectData().getContractor2()
String         estimator.p.getProjectData().getContractor2_city()
String         estimator.p.getProjectData().getContractor3()
String         estimator.p.getProjectData().getContractor3_city()
String         estimator.p.getProjectData().getFrontpageProposalText()
java.util.Date estimator.p.getProjectData().getStartDate()
java.util.Date estimator.p.getProjectData().getBidDate()
String         estimator.p.getProjectData().getStatus()
double         estimator.p.getProjectData().work()
String         estimator.p.getProjectData().getRsx()

Project library
ProjectLibrary estimator.plib
int            estimator.plib.getNumber(int i)
String         estimator.plib.getContractNumber(int n)
String         estimator.plib.getDescription(int n)
String         estimator.plib.getClient(int n)
String         estimator.plib.getContractor(int n)
String         estimator.plib.getContractor_city(int n)
String         estimator.plib.getContractor2(int n)
String         estimator.plib.getContractor2_city(int n)
String         estimator.plib.getContractor3(int n)
String         estimator.plib.getContractor3_city(int n)
String         estimator.plib.getFrontpageProposalText(int n)
java.util.Date estimator.plib.getStartDate(int n)
java.util.Date estimator.plib.getBidDate(int n)
String         estimator.plib.getStatus(int n)
double         estimator.plib.work(int n)
boolean        estimator.plib.isNumberStringActive(int n)
ProjectData    estimator.plib.getProjectData(int n)
int            estimator.plib.size()