Calculated Field Not Working

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
thecomputerchap
Veteran Member
Posts: 47
Joined: 2016-08-28 10:37

Calculated Field Not Working

Post by thecomputerchap » 2022-09-05 09:10

Hi all, I have this sql statement set in the Calculated Field tab on AppGini...

Code: Select all

SELECT CONCAT("£",(SELECT `Leads`.`AmountAgreed` FROM `Leads` 
WHERE `Leads`.`id`='%ID%') - (SELECT `Leads`.`AmountPaid` FROM `Leads` 
WHERE `Leads`.`id`='%ID%'))
The statement works beautifully in PhpMyAdmin but when I go to the table view of the generated AppGini site, it is showing 0.00 for that column.

I have set the following for the field...
  • Read Only
  • Data Type = Decimal
  • Length = 10
  • Precision = 2
Any ideas?

Darren.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Calculated Field Not Working

Post by jsetzer » 2022-09-05 10:59

It seems you try to put an alphanumeric character '£' into a numeric field.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Calculated Field Not Working

Post by jsetzer » 2022-09-05 11:23

The statement works beautifully in PhpMyAdmin
Whenever we test our SELECT queries of calculated fields against our database we must not forget that AppGini generated code has to update the column with the return value afterwards. Datatype and perhaps size of the target field must be capable for storing the value. A complete test should include an update of the target field.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

thecomputerchap
Veteran Member
Posts: 47
Joined: 2016-08-28 10:37

Re: Calculated Field Not Working

Post by thecomputerchap » 2022-09-05 13:07

That makes perfect sense Jsetzer! I'll try without the £ and see if that fixes the problem.

Once fixed, how can I reformat the field as currency so it hows the £ please?

Cheers,

Dazzy.

Post Reply