GirdUpYourLoins
New Member
I have the following code which is supposed to for each through a database table and retrieve records based on id:
FOR EACH Proj_Mstr WHERE Proj_Mstr.Proj_client_ID = INTEGER(get-value("clientId")) AND
Proj_Mstr.Proj_deleted = ? NO-LOCK BREAK BY Proj_Mstr.Proj_sort:
jObj:add(STRING(projNumber), Proj_Mstr.Proj_name).
projNumber = projNumber + 1.
END. /* admin 4ea */
There are records that match the criteria, but no records are returned. If I change the variable in the search criteria to a literal, all appropriate records are returned:
FOR EACH Proj_Mstr WHERE Proj_Mstr.Proj_client_ID = 1 AND
Proj_Mstr.Proj_deleted = ? NO-LOCK BREAK BY Proj_Mstr.Proj_sort:
jObj:add(STRING(projNumber), Proj_Mstr.Proj_name).
projNumber = projNumber + 1.
END. /* admin 4ea */
When I test to see if INTEGER(get-value("clientId")) = 1, the return value is true. Why does casting the string to an integer cause the lookup to fail?
FOR EACH Proj_Mstr WHERE Proj_Mstr.Proj_client_ID = INTEGER(get-value("clientId")) AND
Proj_Mstr.Proj_deleted = ? NO-LOCK BREAK BY Proj_Mstr.Proj_sort:
jObj:add(STRING(projNumber), Proj_Mstr.Proj_name).
projNumber = projNumber + 1.
END. /* admin 4ea */
There are records that match the criteria, but no records are returned. If I change the variable in the search criteria to a literal, all appropriate records are returned:
FOR EACH Proj_Mstr WHERE Proj_Mstr.Proj_client_ID = 1 AND
Proj_Mstr.Proj_deleted = ? NO-LOCK BREAK BY Proj_Mstr.Proj_sort:
jObj:add(STRING(projNumber), Proj_Mstr.Proj_name).
projNumber = projNumber + 1.
END. /* admin 4ea */
When I test to see if INTEGER(get-value("clientId")) = 1, the return value is true. Why does casting the string to an integer cause the lookup to fail?