PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Code not Branching?
Code not Branching?
Débuté par Pierce, 08 juin 2022 02:34 - Aucune réponse
Posté le 08 juin 2022 - 02:34
When I step through the code it branches to the "ELSE" clause correctly. When I run it as "Debug project" the "IF" statement is processed but not the "ELSE" as I am expecting. Something real weird going on or am I missing something obvious?.
A setting somewhere?.

TableDeleteAll(TABLE_Products_Select)
sPrice_Family_Code = HRetrieveItem(dsQry,5)
IF sPrice_Family_Code = "" THEN
// No Price Code. Not in a price family. Add to table
TableAddLine(TAB_Main.TAB_Lookup.CTPL_Products.CTPL_Products_Select.TABLE_Products_Select,dsQry.Article_Number,dsQry.Article_Description, ...
dsQry.Category_Manager,dsQry.Sales_PTD_TY,dsQry.Price_Family_Code,dsQry.Price_Family_Description, ...
dsQry.Vendor_Name,dsQry.Vendor_Number,dsQry.Category,dsQry.Sub_Category)
ELSE
// Is in a price family. Re-query on the price family field
dsTemp is Data Source
dsTemp.Price_Family_Code = sPrice_Family_Code

sSQL2 is string = "SELECT tblProducts.Article_Number, tblProducts.Article_Description, tblProducts.Category_Manager, tblProducts.Sales_PTD_TY, "
sSQL2 += "tblProducts.Price_Family_Code, tblProducts.Price_Family_Description, tblProducts.Vendor_Name, tblProducts.Vendor_Number, "
sSQL2 += "tblProducts.Category, tblProducts.Sub_Category "
sSQL2 += "FROM tblProducts "
sSQL2 += "WHERE ( tblProducts.Price_Family_Code = {Price_Family_Code})"
sSQL2 += "ORDER BY tblProducts.Category_Manager, tblProducts.Price_Family_Description, tblProducts.Article_Description"

IF HExecuteSQLQuery(dsTemp, sSQL2) THEN
FOR EACH dsTemp
TableAddLine(TAB_Main.TAB_Lookup.CTPL_Products.CTPL_Products_Select.TABLE_Products_Select, dsTemp.Article_Number, dsTemp.Article_Description, ...
dsTemp.Category_Manager, dsTemp.Sales_PTD_TY, dsTemp.Price_Family_Code, dsTemp.Price_Family_Description, ...
dsTemp.Vendor_Name, dsTemp.Vendor_Number, dsTemp.Category, dsTemp.Sub_Category)
END
END
HFreeQuery(dsTemp)
END
HFreeQuery(dsQry)