Using a calculated field for an Auto-fill lookup.

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
kmullins
Posts: 7
Joined: 2023-12-10 16:44
Location: Seattle, WA USA

Using a calculated field for an Auto-fill lookup.

Post by kmullins » 2024-02-07 07:20

This might be a known condition; I couldn't find anything after some searching on the forum.

I tried to use a calculated field from one table as an auto-fill lookup in another. I can get other fields to auto-fill from the same relationship, just not my calculation, which sums values from another table.

As a workaround, would there be a way I could copy the calculated value into a non-calculated field leveraging the hooks file? Would some update command to save the value to the database?

Would this be how I would do that?

Code: Select all

	
	function Catalog_after_insert($data, $memberInfo, &$args) {
		$data['ValueStatic'] = $data['ValueCalculation']
		return TRUE;
	}
Thanks for any guidance.
Kevin
I know enough to be dangerous but not enough to be effective.
AppGini 24.10 rev 1579

kmullins
Posts: 7
Joined: 2023-12-10 16:44
Location: Seattle, WA USA

Re: Using a calculated field for an Auto-fill lookup.

Post by kmullins » 2024-02-07 07:47

Reading other posts, I know my first thought on the code is wrong.
I also forgot the version info: Appgini 24.10 rev 1579

Is this better?

Code: Select all

	function Catalog_after_insert($data, $memberInfo, &$args) {
		 $calc = $data['ValueCalculation'];
       		 sql("update CATALOG set ValueStatic='{$calc}' where id=%ID%", $eo);
		return TRUE;
	}
I know enough to be dangerous but not enough to be effective.
AppGini 24.10 rev 1579

Post Reply