Welcome Guest, Not a member yet? Register   Sign In
Condition Statement Builder?
#3

(This post was last modified: 07-11-2018, 05:24 AM by kaitenz.)

(07-11-2018, 02:55 AM)Pertti Wrote: Am I getting this right, you want to upload CSV file that would update user records in DB? But you want to set conditions for what records would be updated?

I want to set a condition/s that will be stored in the database.
So when I run the upload model, the custom rules will be applied without editing the code, making this easy for the administrators (so they will not call me for "hey! We want to add this condition, blah blah blah) and they can do it by their own.

PHP Code:
// Imagine there's a code here..

// The custom conditions will be placed here
$custom_conds $this->db->get('upload_rules');

if(
$custom_conds->num_rows() > 0)
{
    
$the_rules $custom_conds->result_array();

    foreach(
$the_rules as $key => $rule_set)
    {
        
// Convert pattern into a PHP conditional statement
    
}


And then maybe the rules in the database will look like this

Code:
[rid]     [rule_order]     [rule_pattern]
1         1                fieldname|contains|keyword|callback

// Where pattern is separated by pipe
// Or maybe I can use JSON format for easy organization of condition (because maybe in the future
// I create a condition with if-else if-else

Something like that? Then the order will be based on the order inside the database.
The reason I want to do that is to make the app flexible so any admins can do that. I know this is risky but maybe there's an alternative.

Hope you get my point now. Smile  Big Grin
Reply


Messages In This Thread
Condition Statement Builder? - by kaitenz - 07-11-2018, 12:49 AM
RE: Condition Statement Builder? - by Pertti - 07-11-2018, 02:55 AM
RE: Condition Statement Builder? - by kaitenz - 07-11-2018, 05:18 AM
RE: Condition Statement Builder? - by Pertti - 07-11-2018, 05:29 AM
RE: Condition Statement Builder? - by kaitenz - 07-11-2018, 07:41 AM
RE: Condition Statement Builder? - by Pertti - 07-12-2018, 12:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB