project BLF > class BCustomField > method UnusedCustomFieldsForComponent
Description
Get all unused custom business fields for a business component.
Parameters
icComponentName | input | character | Component Name |
tCustomBusinessFields | output | temp-table | Custom Business Fields |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bcustomfield.p)
if oiReturnStatus = 0
then assign oiReturnStatus = -98.
empty temp-table tCustomBusinessFields.
if index(icComponentName, "[") = 0
then assign vcComponentName = icComponentName
vcUserDefinedContext = "".
else assign vcComponentName = entry(1, icComponentName, "[")
vcUserDefinedContext = entry (1, entry(2, icComponentName, "["), "]").
<M-7 run BusinessClassActions
(input vcComponentName (icClassShortname),
input 'START+OPEN' (icAction),
input no (ilSubtransaction),
input-output viOpenC (biClassOpenCount),
input-output vhBStoredSearchInst (bhClassInstanceHandle),
input-output viBStoredSearchID (biClassInstanceId),
input '' (icDraftReference),
input vcUserDefinedContext (icUserDefinedContext),
output viFcReturnSuper (oiReturnStatus)) in BCustomField>
<M-8 run GetCustomFieldList
(output vcDBTables (ocFieldList),
output viLocalReturn (oiReturnStatus)) in BStoredSearch>
<M-9 run BusinessClassActions
(input vcComponentName (icClassShortname),
input 'CLOSE+STOP' (icAction),
input no (ilSubtransaction),
input-output viOpenC (biClassOpenCount),
input-output vhBStoredSearchInst (bhClassInstanceHandle),
input-output viBStoredSearchID (biClassInstanceId),
input '' (icDraftReference),
input vcUserDefinedContext (icUserDefinedContext),
output viFcReturnSuper (oiReturnStatus)) in BCustomField>
if viLocalReturn <> 0
then assign oiReturnStatus = viLocalReturn.
if viLocalReturn < 0
then return.
if vcDBTables <> ""
then do viFcCount2 = num-entries(vcDBTables) to 1 by -1:
<Q-10 assign vlFcQueryRecordsAvailable = CustomFieldPrim (NoCache)
(input ?, (FieldID)
input entry(viFcCount2, vcDBTables), (FieldName)
input icComponentName, (ComponentName)) in BCustomField >
if vlFcQueryRecordsAvailable = no
then do:
create tCustomBusinessFields.
assign tCustomBusinessFields.tcBusinessFieldName = entry(viFcCount2, vcDBTables).
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomShort" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tcCustomShort"
then assign tCustomBusinessFields.tcDataType = "c"
tCustomBusinessFields.tiMaxLength = 20.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomCombo" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tcCustomCombo"
then assign tCustomBusinessFields.tcDataType = "c"
tCustomBusinessFields.tiMaxLength = 20.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "QADT0" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "ttQADT0" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomDate" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "ttCustomDate"
then assign tCustomBusinessFields.tcDataType = "t"
tCustomBusinessFields.tiMaxLength = 8.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomInteger" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tiCustomInteger"
then assign tCustomBusinessFields.tcDataType = "i"
tCustomBusinessFields.tiMaxLength = 9.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "QADD0" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tdQADD0" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomDecimal" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tdCustomDecimal"
then assign tCustomBusinessFields.tcDataType = "d"
tCustomBusinessFields.tiMaxLength = 18.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") = "QADC02" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") = "tcQADC02" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomLong" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tcCustomLong"
then assign tCustomBusinessFields.tcDataType = "c"
tCustomBusinessFields.tiMaxLength = 255.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "CustomNote" or
entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tcCustomNote"
then assign tCustomBusinessFields.tcDataType = "c"
tCustomBusinessFields.tiMaxLength = 4000.
else
if entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "QADC0"
or entry(2, tCustomBusinessFields.tcBusinessFieldName, ".") begins "tcQADC0"
then assign tCustomBusinessFields.tcDataType = "c"
tCustomBusinessFields.tiMaxLength = 40.
end.
end.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.