Not tested yet, but does this look right? BuildAMvGroupDef:
ServiceKeyID = Service : '*' : SRP_Hash(TableName : 'AMvGroupDef', 'SHA-1', 'BASE32')
AMvGroupDef = Memory_Services('GetValue', ServiceKeyID)
If Len(AMvGroupDef) EQ 0 then
AMvGroupDef=null$
Fields=xlate(TableName,'%FIELDS%' ,'','X')
AllColumnNames = Fields<FIELDS_NAME$>
AllGroupNames = Fields<FIELDS_MV_GROUPNAME$>
NumColumns = DCount(AllColumnNames, @VM)
For ColumnCnt = 1 to NumColumns
ALLColumnName = AllColumnNames<0,ColumnCnt>
AllGroupName = AllGroupNames<0,ColumnCnt>
if AllGroupName<>'' then
locate AllGroupName in AMvGroupDef<1> setting AmvGroupPos then
AMvGroupDef<2,AmvGroupPos,-1>=ALLColumnName
end else
AMvGroupDef<1,AmvGroupPos>=AllGroupName
AMvGroupDef<2,AmvGroupPos,-1>=ALLColumnName
end
end
Next ColumnCnt
Convert @Upper_Case to @Lower_Case in AMvGroupDef
end
return
Comments
Not tested yet, but does this look right?
BuildAMvGroupDef: ServiceKeyID = Service : '*' : SRP_Hash(TableName : 'AMvGroupDef', 'SHA-1', 'BASE32') AMvGroupDef = Memory_Services('GetValue', ServiceKeyID) If Len(AMvGroupDef) EQ 0 then AMvGroupDef=null$ Fields=xlate(TableName,'%FIELDS%' ,'','X') AllColumnNames = Fields<FIELDS_NAME$> AllGroupNames = Fields<FIELDS_MV_GROUPNAME$> NumColumns = DCount(AllColumnNames, @VM) For ColumnCnt = 1 to NumColumns ALLColumnName = AllColumnNames<0,ColumnCnt> AllGroupName = AllGroupNames<0,ColumnCnt> if AllGroupName<>'' then locate AllGroupName in AMvGroupDef<1> setting AmvGroupPos then AMvGroupDef<2,AmvGroupPos,-1>=ALLColumnName end else AMvGroupDef<1,AmvGroupPos>=AllGroupName AMvGroupDef<2,AmvGroupPos,-1>=ALLColumnName end end Next ColumnCnt Convert @Upper_Case to @Lower_Case in AMvGroupDef end return
Memory_Services('SetValue', ServiceKeyID, AMvGroupDef)