Hi
Have been trying to get a calc field depending on a join element to work.
table1
colums: id, date, name, value1, value2, value3, value4
table 2
colums: id, date, name, price1, price2, price3
Form1 table2
tbl2_name - field element
choose from table1: databasejoin element (value: table1_id, label: table1_name)
tbl2_price1 * tbl1_value1 (calc element)
tbl2_price2 * tbl1_value2 (calc element)
Tried with:
$verdi = '{table1___hus_stand_verdi_raw}'; (my databasejoin element name)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('value1')->from('table1')->where('id = ' . $db->quote('$verdi'));
$db->setQuery($query);
$price = $db->loadResult();
return $price;
Anyone see whats wrong ? I only get undefined
Is there a better way to load values into a form from another table ?
Have been trying to get a calc field depending on a join element to work.
table1
colums: id, date, name, value1, value2, value3, value4
table 2
colums: id, date, name, price1, price2, price3
Form1 table2
tbl2_name - field element
choose from table1: databasejoin element (value: table1_id, label: table1_name)
tbl2_price1 * tbl1_value1 (calc element)
tbl2_price2 * tbl1_value2 (calc element)
Tried with:
$verdi = '{table1___hus_stand_verdi_raw}'; (my databasejoin element name)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('value1')->from('table1')->where('id = ' . $db->quote('$verdi'));
$db->setQuery($query);
$price = $db->loadResult();
return $price;
Anyone see whats wrong ? I only get undefined
Is there a better way to load values into a form from another table ?