I have a field called invoice_number and I am trying to calculate it's value. It is an integer.
Here is my code:
INSERT INTO `invoice` (`invoice_number`)
VALUE ( `%ID%` + 1000)
WHERE `invoice`.`ID` = `%ID%`;
it does not work, what am I doing wrong ?
Help with Calculated Field PLEASE!!
Re: Help with Calculated Field PLEASE!!
(1) SQL queries for Calculated Fields in AG must return exactly one value. You have to define aINSERT INTO `invoice` (`invoice_number`)
SELECT
statement rather than an INSERT
command.---
(2) Also, always use proper qoutes:WHERE `invoice`.`ID` = `%ID%`
single qoutes
'
for 'values'
and backticks `
for table- and column-names `tn`.`cn`
---
Try this instead:
Code: Select all
SELECT 12345
FROM `invoice`
WHERE `invoice`.`ID` = '%ID%';
12345
by the formula you need.Tip
Whenever you have problems with custom database commands, check for SQL errors in Administration area.
Wish
When posting here, please always put code fragments inside
[code]...[/code]
blocks for better readability.Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.14 Revision 1665 + all AppGini Helper tools
<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 readabilityAppGini 24.14 Revision 1665 + all AppGini Helper tools
Re: Help with Calculated Field PLEASE!!
Thanks for the help, I just figured it out as you sent me the answer.