Re: Counting Records in TI
Posted: Thu May 30, 2013 11:21 pm
by Economic
Hi Declan,
There is a long list of generated statements of CellPutN, but left most of these out as I don't believe it is causing the problem.
In the prolog tab:
#****Begin: Generated Statements***
DIMENSIONSORTORDER('Shipment_Type','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('Client_Code','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('reps_cde','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('Inco_Terms','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('Carrier_No','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('orig_cde','','','BYINPUT','ASCENDING');
DIMENSIONSORTORDER('dest_cde','','','BYINPUT','ASCENDING');
OldCubeLogChanges = CUBEGETLOGCHANGES('au-customer_detail');
CUBESETLOGCHANGES('au-customer_detail', 0);
#****End: Generated Statements****
Cube01='au-customer_summary';
Cube02='au-customer_detail';
subname='zZeroActualsCustomer';
IF(VIEWEXISTS(Cube01, 'zZeroActuals')=1);
VIEWDESTROY(Cube01, 'zZeroActuals');
ENDIF;
IF(VIEWEXISTS(Cube02, 'zZeroActuals')=1);
VIEWDESTROY(Cube02, 'zZeroActuals');
ENDIF;
VIEWCREATE(Cube01, 'zZeroActuals');
VIEWCREATE(Cube02, 'zZeroActuals');
#Year
IF(SUBSETEXISTS('hwl_year', subname)=1);
SUBSETDESTROY('hwl_year', subname);
ENDIF;
SUBSETCREATE('hwl_year', subname);
SUBSETELEMENTINSERT('hwl_year', subname, pYear, 1);
VIEWSUBSETASSIGN(Cube01, 'zZeroActuals', 'hwl_year', SubName);
VIEWSUBSETASSIGN(Cube02, 'zZeroActuals', 'hwl_year', SubName);
#Month
IF(SUBSETEXISTS('hwl_month', subname)=1);
SUBSETDESTROY('hwl_month', subname);
ENDIF;
SUBSETCREATE('hwl_month', subname);
SUBSETELEMENTINSERT('hwl_month', subname, pMonth, 1);
VIEWSUBSETASSIGN(Cube01, 'zZeroActuals', 'hwl_month', SubName);
VIEWSUBSETASSIGN(Cube02, 'zZeroActuals', 'hwl_month', SubName);
VIEWZEROOUT(Cube01,'zZeroActuals');
VIEWZEROOUT(Cube02,'zZeroActuals');
iCount = 1;
In the Metadata Tab:
IF(SUBST(ShipperOrConsignee,2,1)@='');
ShipperOrConsignee = 'UNKNOWN';
ELSEIF(SUBST(ShipperOrConsignee,1,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,2,LONG(ShipperOrConsignee)-1);
ELSEIF(SUBST(ShipperOrConsignee,7,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,1,6);
ELSEIF(SUBST(ShipperOrConsignee,8,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,1,7);
ENDIF;
#****Begin: Generated Statements***
vShipmentNo=SUBST(ShipmentNo,3,5);
vBranchCode=SUBST(ShipmentNo,1,2);
vDepartmentCode=SUBST(ShipmentNo,8,2);
vCostCenter=CELLGETS('BrnDept_Lookup',vBranchCode|vDepartmentCode,'Cost Centre');
vOrigin=IF(SUBST(OriginCountry|OriginCity,1,1)@='','Unknown',OriginCountry|OriginCity);
vDestination=IF(SUBST(DestinationCountry|DestinationCity,1,1)@='','Unknown',DestinationCountry|DestinationCity);
vVersion='Actual';
vMonth=IF(LONG(ShipmentDate)=9,SUBST(ShipmentDate,3,2),SUBST(ShipmentDate,4,2));
vYear=IF(LONG(ShipmentDate)=9,SUBST(ShipmentDate,6,4),SUBST(ShipmentDate,7,4));
DIMENSIONELEMENTINSERT('Shipment_Type','',ShipmentType,'n');
DIMENSIONELEMENTINSERT('Client_Code','',ShipperOrConsignee,'n');
DIMENSIONELEMENTINSERT('reps_cde','',SalesRepName,'n');
DIMENSIONELEMENTINSERT('Inco_Terms','',IncoTerms,'n');
DIMENSIONELEMENTINSERT('Carrier_No','',CarrierNo,'n');
DIMENSIONELEMENTINSERT('orig_cde','',vOrigin,'n');
DIMENSIONELEMENTINSERT('dest_cde','',vDestination,'n');
#****End: Generated Statements****
In the Data Tab:
IF((SUBST(ShipmentNo,1,1)@='3')%(SUBST(ShipmentNo,1,1)@=''));
ITEMSKIP;
ENDIF;
IF(SUBST(ShipperOrConsignee,2,1)@='');
ShipperOrConsignee = 'UNKNOWN';
ELSEIF(SUBST(ShipperOrConsignee,1,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,2,LONG(ShipperOrConsignee)-1);
ELSEIF(SUBST(ShipperOrConsignee,7,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,1,6);
ELSEIF(SUBST(ShipperOrConsignee,8,1)@='-');
ShipperOrConsignee = SUBST(ShipperOrConsignee,1,7);
ENDIF;
iCount = 1;
CellPutN(1, 'au-customer_detail',vYear,vMonth,vVersion,vCostCenter,vShipmentNo,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Job / Shipment Count');
CellPutN(iCount, 'au-customer_detail',vYear,vMonth,vVersion,vCostCenter,vShipmentNo,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Job / Shipment Count');
#****Begin: Generated Statements***
vShipmentNo=SUBST(ShipmentNo,3,5);
vBranchCode=SUBST(ShipmentNo,1,2);
vDepartmentCode=SUBST(ShipmentNo,8,2);
vCostCenter=CELLGETS('BrnDept_Lookup',vBranchCode|vDepartmentCode,'Cost Centre');
vOrigin=IF(SUBST(OriginCountry|OriginCity,1,1)@='','Unknown',OriginCountry|OriginCity);
vDestination=IF(SUBST(DestinationCountry|DestinationCity,1,1)@='','Unknown',DestinationCountry|DestinationCity);
vVersion='Actual';
vMonth=IF(LONG(ShipmentDate)=9,SUBST(ShipmentDate,3,2),SUBST(ShipmentDate,4,2));
vYear=IF(LONG(ShipmentDate)=9,SUBST(ShipmentDate,6,4),SUBST(ShipmentDate,7,4));
CellPutN(CellGetN('au-customer_detail',vYear,vMonth,vVersion,vCostCenter,vShipmentNo,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Actual Weight (KG)')+ActualWeightKgs,'au-customer_detail',vYear,vMonth,vVersion,vCostCenter,vShipmentNo,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Actual Weight (KG)');
#****End: Generated Statements****
CellPutN(ActualWeightKgs,'au-customer_summary',vYear,vMonth,vVersion,vCostCenter,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Actual Weight (KG)');
CellPutN(ChargeableWeight,'au-customer_summary',vYear,vMonth,vVersion,vCostCenter,ShipmentType,ShipmentStat,ShipmentTerms,IncoTerms,MovementType,vOrigin,vDestination,ShipperOrConsignee,SalesRepName,CarrierNo,'Chargeable Weight (KG)');