PHP code generation - scoped variable problem

In an afterInsert event, I provide the following code:

if( sc_changed( {Gravity_Factor} ) ) {
 $gravity_factor = sc_sql_injection({Gravity_Factor});
 $sql .= "Gravity_Factor";
 $sqlv .= "'".$gravity_factor."'";
}

That produces this generated code:

if($this->nmgp_dados_form['gravity_factor'] != $this->gravity_factor ) {
        [B]$this->gravity_factor[/B] = $this->Db->qstr($this->gravity_factor );
        $sql .= "Gravity_Factor";
        $sqlv .= "'".[B]$gravity_factor[/B]."'";
}

Which produces a runtime error because $gravity_factor is undefined, because it has not been explicitly scoped to the class.

There are a number of potential errors made likely here, because ScriptCase does not preserve the variable name case. Ouch!

But it’s the scoping issue that I’m reporting, which looks like a string parsing problem for the event code.

You can create variables with app scope in scriptcase: in Programming and Atributes, and you can use this variable like that: {var_name}

If you want i can show in skype sharing my desktop.

Hello,

Issue reported to our bugs team.

regards,
Bernhard Bernsmann

Thanks Paulo. I know how to work around the problem, but the vendor needs to know about the problem so that, eventually, we won’t have a problem to work around.

Then there will be peace, happiness, and cake. :slight_smile:

In this post I suggested a good thing for us (scriptcase’s clients):

http://www.scriptcase.net/forum/showthread.php?6254-Dear-netmake-please-fix-the-dictionary-problems-help-text-deleted&p=23719#post23719