[TYPO3-english] Calculations in typoscript
Jigal van Hemert
jigal.van.hemert at typo3.org
Sun Aug 12 18:44:18 CEST 2012
Hi,
On 12-8-2012 17:06, Piotr Burda wrote:
> markers.master_input_wart = CONTENT
> markers.master_input_wart {
> table = tx_pbjokapricelist_prices_full
> select {
> pidInList = 27
> orderBy = uid
> selectFields = uid, group_a_1_3
> # possible conditions
> where = ( tx_pbjokapricelist_prices_full.uid='1')
> }
> renderObj = COA
> renderObj {
> #value
> 1 = TEXT
> 1.insertData = 1
> 1.data = field:group_a_1_3
> 1.stdWrap.wrap = |*3
> 1.prioriCalc = 1
> }
> }
>
> But i need to mutiply in line 1.stdWrap.wrap = |*3 , using a value
> submitted by form, ho to do it?
You could let the database do the calculation:
selectFields = uid, ###factor### * group_a_1_3 as totalgroup
select {
markers {
factor.data = GP:formfield
factor.intval = 1
...
renderObj = COA
renderObj {
1 = TEXT
1.field = totalgroup
....
Putting the stuff in markers makes sure that you can safely use form
data without having to worry about SQL injection problems.
--
Jigal van Hemert
TYPO3 Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-english
mailing list