project BLF > class Business Component > method GetKeyFields

Description

Returns the name of all key fields of a table in the class dataset.

primary key = all fields of the primary index of the table
alternate key = all fields of an index that is an 'alternate key'
(If a table has exactly one unique index other than the primary index, and all fields in that index are business fields, this index automatically becomes the alternate key. Otherwise an index must be marked as alternate key manually.)
object ID = one field of the table that is an 'identity' field
object status = one or more fields of the table that is a 'status' field


Parameters


bcTableNameinput-outputcharacterDatabase table name.
When left blanc, the name of the main table of the class dataset will be returned.
ocPrimaryKeyoutputcharactercomma seperated list of database field names (excluding table name)
ocAlternateKeyoutputcharactercomma seperated list of database field names (excluding table name)
these fields MUST be defined as business field
ocObjectIDoutputcharacterdatabase field name (excluding table name) of the identity field
ocObjectStatusoutputcharacterdatabase field name (excluding table name) of the status field
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method business.GetCustomFieldValues
method database.ApiForcePublish
method database.ApiGetIdentification
method database.EventPublishing
method database.GetActivitiesForObject
method database.GetPKValues
method database.GetXmlRepresentationDataset
method database.MaintainByDatasetWithOutput
method database.UpdateWorkobject
method database.ValidateActivityCode
method BDocumentLink.ApiDumpDocuments
method other.WriteData

QadFinancials
method BAddressType.ApiStdMaintainTT
method BBLWICountry.ApiStdMaintainTT
method BCInvoice.ApiStdMaintainTTWithExtPost
method BCInvoice.ApiStdMaintainTTWithIntPost
method BDInvoice.ApiStdMaintainTTWithExtPost
method BDInvoice.ApiStdMaintainTTWithIntPost
method BFixedAssetAsset.ApiStdMaintainTT
method BLayer.ApiStdMaintainTT
method BSafStructureLink.ApiStdMaintainTT
method BYearClosing.ApiStdMaintainTT


program code (program1/business.p)

if bcTableName = "fcInstance":U
then assign ocPrimaryKey = "Instance_ID":U.
else if search ("appinfo/" + lc(vcFcComponentName) + "_key.r") <> ?
     or search ("appinfo/" + lc(vcFcComponentName) + "_key.p") <> ?
     then run value ("appinfo/" + lc(vcFcComponentName) + "_key.p")
             (input-output bcTableName,
              output ocPrimaryKey,
              output ocAlternateKey,
              output ocObjectID,
              output ocObjectStatus,
              output vcDummy).