On Feb 16, 2010, at 6:31 AM, Tony P wrote:

> We're converting a legacy DB (4D 2003 and A4Dv3) up to v11 and A4D v5, but 
> I'm having trouble getting "auto create vars = true" in Active4D.ini to work. 
> The parameter mode is set to form variables, but it doesn't make any 
> difference whether it is or not. The local variables are not created.
> 
> Auto create vars is not good coding practice and I can code around this. 
> However, there are over 200 .a4d files in this project so it's not something 
> I want to tackle immediately. With a query param of test=999
> defined($test) -> false
> a4d.debug.dump request  -> shows test as a query param (or form variable if I 
> have parameter mode = form variables)
> a4d.debug.dump locals(true; true) -> no sign of test
> 
> Fusebox is not being used, but I've also verified this behaviour on the demo 
> database (where it appears in the $attributes collection but still not as a 
> local).
> 
> Platform is Mac OS X 10.5.8 using 4D v11.5 and A4D v5.0r11 (with 4D as the 
> web server).

When I converted to fusebox several years ago, I had one app that I did not 
convert to fusebox that relied on auto create. I ended up turning auto create 
off and created my own local variables. I just stuck this code in the app 
driver. It just does what fusebox does to create $attributes and then stuffs 
$attributes into local variables.

It is just a band-aid until you can figure out what is wrong.

if (request info{"*request method"} = "POST")
        $attributes := merge collections(query params; form variables) // POST 
overwrites GET
else
        $attributes := merge collections(form variables; query params) // GET 
overwrites POST
end if
for each ($attributes; $key; $value)
        $localKey := "$"+$key
        if (not(collection has(local variables;$localKey)))
                local variables{$localKey} := $value
        end if
end for each

Steve Alex
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to