Skip to main content


persistent class Sample.Company extends %Library.Persistent, %Library.Populate, %XML.Adaptor

SQL Table Name: Sample.Company

This sample persistent class represents a company.

Property Inventory

Method Inventory


relationship Employees as array of Employee [ InitialExpression = $listbuild("Sample.Employee","Company",+$this,"many",1,1) , Transient , Inverse = Company , Cardinality = many ];
The Employee objects associated with this Company.
Property methods: EmployeesGet(), EmployeesGetObject(), EmployeesGetObjectId(), EmployeesGetSwizzled(), EmployeesIsEmpty(), EmployeesIsValid(), EmployeesNewObject(), EmployeesRClose(), EmployeesRExec(), EmployeesRFetch(), EmployeesRelate(), EmployeesSQLCompute(), EmployeesSet(), EmployeesUnRelate()
property Mission as %String (MAXLEN = 200, POPSPEC = "Mission()");
The company's mission statement.
Property methods: MissionDisplayToLogical(), MissionGet(), MissionGetStored(), MissionIsValid(), MissionLogicalToDisplay(), MissionLogicalToOdbc(), MissionNormalize(), MissionSet()
property Name as %String (MAXLEN = 80, POPSPEC = "Company()") [ Required ];
The company's name.
Property methods: NameDisplayToLogical(), NameGet(), NameGetStored(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize(), NameSet()
property Revenue as %Integer;
The last reported revenue for the company.
Property methods: RevenueDisplayToLogical(), RevenueGet(), RevenueGetStored(), RevenueIsValid(), RevenueLogicalToDisplay(), RevenueNormalize(), RevenueSet(), RevenueXSDToLogical()
property TaxID as %String [ Required ];
The unique Tax ID number for the company.
Property methods: TaxIDDisplayToLogical(), TaxIDGet(), TaxIDGetStored(), TaxIDIsValid(), TaxIDLogicalToDisplay(), TaxIDLogicalToOdbc(), TaxIDNormalize(), TaxIDSet()


method PrintPayroll()
This method prints out the payroll for this company by iterating over all the Employee objects related to it and printing their names and salaries.
You can try this out from the Caché command line by opening an instance of Company object and invoking this method:
  Set company = ##class(Sample.Company).%OpenId(1)
  Do company.PrintPayroll()


index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()
index (NameIdx on Name);
Define an index for Name.
Index methods: NameIdxExists()
index (TaxIDIdx on TaxID) [Unique];
Define a unique index for TaxID.
Index methods: TaxIDIdxCheck(), TaxIDIdxCheckUnique(), TaxIDIdxDelete(), TaxIDIdxExists(), TaxIDIdxOpen(), TaxIDIdxSQLCheckUnique(), TaxIDIdxSQLExists(), TaxIDIdxSQLFindPKeyByConstraint(), TaxIDIdxSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods


Storage Model: CacheStorage (Sample.Company)

FeedbackOpens in a new tab