UDT and calculation with LISE fields converted to numbers Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
webform
Power Poster
Power Poster
Posts: 524
Joined: Sat Nov 25, 2006 3:39 pm

UDT and calculation with LISE fields converted to numbers

Post by webform »

I have a LISE Instance with fields containing numbers i want to add together.

I'm using an UDT and an Event Handler (PreItemSave) for the LISE Instance to save the result of the calculation. But it seems my LISE fields is not accepted as numbers. What am i doing wrong here?

My UDT:

Code: Select all

$item = $params['item_object'];

//Set Vars
$firstfield = (int)$item->firstfield;
$secondfield = (int)$item->secondfield;
$thirdfield = (int)$item->thirdfield;

//Calculate Total
$total = $firstfield + $secondfield + $thirdfield;

//Save To LISE Instance
$item->total = $total;
User avatar
webform
Power Poster
Power Poster
Posts: 524
Joined: Sat Nov 25, 2006 3:39 pm

Re: UDT and calculation with LISE fields converted to numbers

Post by webform »

Oh! I found the solution at https://cmscanbesimple.org/blog/the-lise-module

Code: Select all

$firstfield = (int)(string)$item->firstfield;
Post Reply

Return to “Modules/Add-Ons”