Field Formula Apply formula for fields before insert/update operation (added in version 2.5)

You can apply basic formula to change value of the field before insert/update operation dynamically. It can be done using the callback function also but this function is added to provide more convenient way to do same. It also helps to set the value to NULL for empty values to help to enter data in case of database restriction for e.g. saving NULL for datetime for empty values.

  
                                    $pdocrud = new PDOCrud();
                                     // format field to 2 decimal point
                                    $pdocrud->fieldFormula("tax", "formula",array("type" =>"round","decimalpoint"=>2));
                                    // format field to 2 decimal point
                                    $pdocrud->fieldFormula("product_discount", "formula",array("type" =>"number_format","decimalpoint"=>2));
                                    // get ceil value of field
                                    $pdocrud->fieldFormula("product_price", "formula",array("type" =>"ceil"));
                                    //get floor value of field
                                    $pdocrud->fieldFormula("product_sell_price", "formula",array("type" =>"floor"));
                                    //string type - adding prefix of sku always and checking for duplicate i.e. string already have sku or not
                                    $pdocrud->fieldFormula("product_id","string",array("type" =>"prefix","str"=>"SKU_","duplicate"=>true));
                                    //make product name first letter upper case
                                    $pdocrud->fieldFormula("product_name", "string",array("type" =>"uppercase"));
                                    //setting value to NULL if empty
                                    $pdocrud->fieldFormula("added_Date", "string",array("type" =>"null"));
                                     
                                    echo $pdocrud->dbTable("products")->render();
                            

Formula based field content formatting


Deprecated: Required parameter $field follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $task follows optional parameter $op in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrud.php on line 924

Deprecated: Required parameter $totalrecords follows optional parameter $page in /home/javad/domains/javadfk.ir/public_html/pdocrud/script/classes/PDOCrudHelper.php on line 191

Products

Showing 1 to 5 of 108 entries

# Product id Product name Product line ProductScale ProductVendor Product description Product image Product url Qty available Product price Product sell price Tax Product discount Added date Actions
1 S10_1949 1952 Alpine Renault 1300 Classic Cars 1:10 Classic Metal Creations Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis. http://findicons.com/files/icons/1673/diagram_part_2/96/diagram_v2_17.png http://demo.digitaldreamstech.com/formdoid/script/documentation/formdoid/ 7305 50.00 214.30 0 0 2016-12-20
2 S10_4757 1972 Alfa Romeo GTA Classic Cars 1:10 Motor City Art Classics Features include: Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis. http://findicons.com/files/icons/2834/flatastic_part_2/128/product.png https://codecanyon.net/user/ddeveloper/portfolio?ref=ddeveloper 3252 85.68 136.00 0 0 2016-12-20
3 S10_4962 1962 LanciaA Delta 16V Classic Cars 1:10 Second Gear Diecast Features include: Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis. http://displays2go.com.au/slir/w144-h144/images/product_images/1369184182.jpg https://codecanyon.net/user/ddeveloper/portfolio?ref=ddeveloper 6791 103.42 147.74 0 0 2016-12-20
4 S12_1099 1968 Ford Mustang Classic Cars 1:12 Autoart Studio Design Hood, doors and trunk all open to reveal highly detailed interior features. Steering wheel actually turns the front wheels. Color dark green. http://displays2go.com.au/slir/w144-h144/images/product_images/1384248587.jpg https://codecanyon.net/item/wordpress-awesome-import-export-plugin/12896266 68 95.34 194.57 0 0 2016-12-20
5 S12_1108 2001 Ferrari Enzo Classic Cars 1:12 Second Gear Diecast Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis. http://displays2go.com.au/slir/w144-h144/images/product_images/1392593620.jpeg https://codecanyon.net/user/ddeveloper/portfolio?ref=ddeveloper 3619 95.59 207.80 0 0 2016-12-20
# Product id Product name Product line ProductScale ProductVendor Product description Product image Product url Qty available Product price Product sell price Tax Product discount Added date Actions