Hi All
I have the following fields in my query calculating various values but in the end i need to know the Percentage of Waste value. This is working ok but i would like to sort based on the WastePercent field grouping anything 5% or less together, anything between 5% and 10% together and then finally anything over 10% together. The SortOrder field shows the correct values for this grouping process, but when i try to sort ascending for that specific field it throws up a dialog asking for WastePercent as a parameter.
I believe it has something to do with aliases but not entirely sure. In the above anything that starts "del_" is a field from a table
If it is because of the aliases for the calculated fields i'm not entirely sure what to do about it so would appreciate any pointers as to the best way to group things together in this query as specified
Hope that makes sense, happy to provide any more information as required
kind regards
Glen
I have the following fields in my query calculating various values but in the end i need to know the Percentage of Waste value. This is working ok but i would like to sort based on the WastePercent field grouping anything 5% or less together, anything between 5% and 10% together and then finally anything over 10% together. The SortOrder field shows the correct values for this grouping process, but when i try to sort ascending for that specific field it throws up a dialog asking for WastePercent as a parameter.
Code:
totalSellingKG: IIf(([del_prod_case_num_kept]=0) Or ([del_prod_case_num_kept] Is Null),[del_prod_case_num_orig]*[del_prod_count]*[del_prod_weight],[del_prod_case_num_kept]*[del_prod_count]*[del_prod_weight])
totalSoldKg: IIf(([del_prod_sale_case_num]=0) Or ([del_prod_sale_case_num] Is Null),[totalSellingKG],IIf([del_prod_sale_count]*[del_prod_sale_weight]=0,[del_prod_sale_case_num]*[del_prod_count]*[del_prod_weight],[del_prod_sale_case_num]*[del_prod_sale_count]*[del_prod_sale_weight]))
QuantityClaim: del_prod_claim_cust_quant
SellingTotal: [totalSellingKG]*[del_prod_sale_final_price]
SoldTotal: [totalSoldKg]*[del_prod_sale_final_price]
WastePercent: IIf([SellingTotal]=[SoldTotal],Round(([QualityClaim]/[SellingTotal])*100),Round(([QualityClaim]/[SoldTotal])*100))
SortOrder: IIf(Nz([WastePercent],0)<=5,1,IIf(Nz([WastePercent],0)>5 And Nz([WastePercent],0)<=10,2,3))
I believe it has something to do with aliases but not entirely sure. In the above anything that starts "del_" is a field from a table
If it is because of the aliases for the calculated fields i'm not entirely sure what to do about it so would appreciate any pointers as to the best way to group things together in this query as specified
Hope that makes sense, happy to provide any more information as required
kind regards
Glen