You have session.root.addChild.
I take it that there is a CFC named root.cfc in your session scope with the
method of addChild?
If this is so and you are using cfscript, why not just call the method?
session.root.addChild(name="#tempName#", key="#i#");
You don't have to prefix a temporary variable to store a component that is
ina shared scope. The shared scope component is already available. You
may want to check to see if the component exists prior to assignings values
to the method.
Teddy
On 10/16/06, Dave Hoff <[EMAIL PROTECTED]> wrote:
>
> Thanks Rob. I'll try and paste the entire code below.
> ------------------------------------------------
> for(i=1; i LTE getTopLevel.recordset.recordcount; i=i+1)
> {
> tempName = getTopLevel.recordset.name[i];
> tempCFC = "gateway.imified.apps." & getTopLevel.recordset.cfc_name[i];
> tempMethod = getTopLevel.recordset.entry_method[i];
> tempService = getTopLevel.recordset.Id[i];
> tempVar = "session.M" & i;
>
> if(
> getTopLevel.recordset.cfc_name NEQ "")
> #tempVar# = session.root.addChild(name="#tempName#", key="#i#");
> else
> #tempVar# = session.root.addChild(name="#tempName#", key="#i#", cfc="
> gateway.imified.apps.#tempCFC#", method="#tempMethod#");
>
> // Get children
> SQLString = "select * from methods where service_id = " & tempService & "
> order by sort_order asc";
> DATASOURCE = request.dsn;
> getChildren = query(sql=SQLString, datasource=DATASOURCE);
>
> for(j=1; j LTE getChildren.recordset.recordcount; j=j+1)
> {
> childName = getChildren.recordset.method_name[i];
> childCFC = "gateway.imified.apps." & getChildren.recordset.cfc_name[i];
> childMethod = getChildren.recordset.entry_method[i];
> childVar = "session.m" & i & "_" & j;
>
> #childVar# = #tempVar#.addChild(name="#childName#", key="#j#",
> cfc="#childCFC#", method="#childMethod#");
> }
> }
> ---------------------------------------------------------
>
> CF throws the following error:
> Invalid CFML construct found on line 122 at column 95. ColdFusion was
> looking at the following text:<p>.</p><p>The CFML compiler was
> processing:<ul><li>a script statement beginning with ""#"" on line 122,
> column 73.
>
> Looks like it has a problem with:
> #childVar# = #tempVar#.addChild(name="#childName#", key="#j#",
> cfc="#childCFC#", method="#childMethod#");
>
> Temp var is causing the trouble. Does the code above (as messy as it is)
> look like it should work?
>
> Thanks.
>
> >On 10/16/06, Dave Hoff <[EMAIL PROTECTED]> wrote:
> >
> >What error is thrown? For readability (and maybe functionality), try:
> >
> >childVar = session['M' & i & '_' & j];
> >tempVar = session['M' & i];
> >
> >Or, just do it all at once:
> >
> >session['M' & i & '_' & j] = session['M' & i].addChild ( ... );
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256924
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4