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: Optional parameter $op declared before required parameter $task is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 983

Deprecated: Creation of dynamic property PDOCrud::$langData is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2227

Deprecated: Optional parameter $page declared before required parameter $totalrecords is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrudHelper.php on line 191

Deprecated: Optional parameter $parameters declared before required parameter $data is implicitly treated as a required parameter in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrudTableFormat.php on line 122

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 119

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 1011

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 1011

Deprecated: Creation of dynamic property PDOModel::$characterSet is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 119

Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOModel.php on line 1011

Deprecated: Creation of dynamic property PDOCrud::$dataHTML is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2379

Deprecated: Creation of dynamic property PDOCrud::$fieldList is deprecated in /home3/openscri/public_html/masinosinaga/pdo-crud/script/classes/PDOCrud.php on line 2380

Products

Showing 1 to 3 of 101 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 Product cat Actions
1 S10_4698 2003 Harley-Davidson Eagle Drag Bike Motorcycles 1:10 Red Start Diecast Model features, official Harley Davidson logos and insignias, detachable rear wheelie bar, heavy diecast metal with resin parts, authentic multi-color tampo-printed graphics, separate engine drive belts, free-turning front fork, rotating tires and rear racing slick, certificate of authenticity, detailed engine, display stand , precision diecast replica, baked enamel finish, 1:10 scale model, removable fender, seat and tank cover piece for displaying the superior detail of the v-twin engine http://findicons.com/files/icons/2738/pretty_office_icon_set_part_9/128/product_documentation.png http://demo.digitaldreamstech.com/SimplifiedDB/documentation/PDO/pdo-transactions.php 5582 91.02 193.66 0 0 2016-12-20 Electronics
2 S12_1666 1958 Setra Bus Trucks and Buses 1:12 Welly Diecast Productions Model features 30 windows, skylights & glare resistant glass, working steering system, original logos http://displays2go.com.au/slir/w144-h144/images/product_images/1369181990.jpg https://codecanyon.net/user/ddeveloper/portfolio?ref=ddeveloper 1579 77.90 136.67 0 0 2016-12-20 Electronics
3 S12_2823 2002 Suzuki XREO Motorcycles 1:12 Unimax Art Galleries Official logos and insignias, saddle bags located on side of motorcycle, detailed engine, working steering, working suspension, two leather seats, luggage rack, dual exhaust pipes, small saddle bag located on handle bars, two-tone paint with chrome accents, superior die-cast detail , rotating wheels , working kick stand, diecast metal with plastic parts and baked enamel finish. http://displays2go.com.au/slir/w144-h144/images/product_images/1392609013.jpg https://codecanyon.net/user/ddeveloper/portfolio?ref=ddeveloper 9997 66.27 150.62 0 0 2016-12-20 Electronics
# 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 Product cat Actions