I have a master form and a detail form.
This is how the application is supposed to work:
the user enters a value in variable A in master form.
when the user adds a record to detail form, Variable B is supposed to be updated with Variable A,
and then Variable C (which is still in the same record) uses the value in variable B in the where clause of its sql statement (variable C is of type select).
now in order to update the variable B I added an event onLoadRecord in detail form with this code:
$currentID = {ID};
//$sql = “select VariableA from masterTable where ID= $currentID”;
$sql = "select VariableA from masterTable where ID= 18 ";
sc_lookup(rs,$sql);
if ({rs} === false)
{
echo “Access error.”;
}
elseif (empty({rs}))
{
echo “Select command didn’t return data”;
}
else
{
//echo {rs[0][0]};
{VariableB} = {rs[0][0]};
};
now, if you see i have two sql statements , one of them commented out. When the second sql statement runs, i get exactly what i want -> when adding record, Variable B is updated and Variable C is correctly using it to get the right results.
but when i use the first sql (which has a variable), this is what i get.(i checked many diffrent types of adding a variable to my sql statement, none of them work)
andI have debug turned on so i can see the sqls that get sent.
as you can see both the sqls in both cases say: select CustomerName from workorder where WOID = 18
This is the select sql statement for variable C in case anyone needs it
SELECT PartDescription
FROM customerparts
where Vendor = “{VariableB}”
ORDER BY PartDescription
but i dont know that why i get diffrent results when i get the correct sql statement whether I type number 18 or if i use a variable with value 18.
Please help, im so lost.