Calculating Group ID and Record ID

var sGroupId   :string;
    sGroupName :string;
begin
 sGroupId   := GetVariable('vGroupID');
 sGroupName := GetVariable('vGroupName');
 if sGroupId='' then
   begin
    SetVariable('vGroupID','0');
    SetVariable('vGroupName',[CATEGORYNAME]);
    Result:='0';
   end  
  else if sGroupName<>[CATEGORYNAME] then
   begin
    sGroupId:=IntToStr(StrToInt(sGroupId)+1);
    SetVariable('vGroupID',sGroupId);
    SetVariable('vGroupName',[CATEGORYNAME]);
    Result:=sGroupId;
   end
  else
   Result:=sGroupId;
end;
var sId   :string;
    sGroupName :string;
begin
 sId   := GetVariable('vID');
 sGroupName := GetVariable('vGroupName1');
 if (sId='') or (sGroupName<>[CATEGORYNAME]) then
   begin
    SetVariable('vID','1');
    SetVariable('vGroupName1',[CATEGORYNAME]);
    Result:='1';
   end  
  else 
   begin
    sID:=IntToStr(StrToInt(sID)+1);
    SetVariable('vID',sID);
    Result:=sID;
   end
end;

For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions

Confused? Ask question on our ETl forum

  • knowledgebase/calculating_group_id_and_record_id.txt
  • Last modified: 17/09/2018 09:44
  • by admin