Re: nesting custom tags

2004-04-09 Thread Jennifer Knoblock
The first tag...

cfset dsn=caller.dsn

cfquery name=getSets datasource=#dsn#
select * from TMSSets where TMSSETID='#attributes.setid#' order by tmssetid
/cfquery

	cfif getsets.Router is 1
	cfset Complist=GWS,ADUA,DSA,Router
	cfelse
	cfset Complist=GWS,ADUA,DSA
	/cfif
	
	cfloop list=#CompList# index=i
	
	cf_TMSStatusColor setid=#attributes.setid# type=#i#
	cfquery datasource=#dsn#
	update ComponentStatus set FENStatus='#FENStatusBackground#' where setid='#attributes.setid#' and comptype='#i#'
	/cfquery
	
	cf_TMSStatusColorIAVA setid=#attributes.setid# type=#i#
	cfquery datasource=#dsn#
	update ComponentStatus set IAVAStatus='#IAVAStatusBackground#' where setid='#attributes.setid#' and comptype='#i#'
	/cfquery
	/cfloop
	
	cfset FullList=GWS,ADUA,DSA
	cfif getsets.router is 1
	cfset FullList=ListAppend(FullList, Router)
	/cfif
	cfif getsets.TACLANE is 1
	cfset FullList=ListAppend(FullList, TACLANE)
	/cfif
	
	cfloop list=#FullList# index=i
	cf_TMSStatusColorAI setid=#attributes.setid# type=#i#
	cfquery datasource=#dsn#
	update ComponentStatus set AIStatus='#AIStatusBackground#' where setid='#attributes.setid#'
	/cfquery
	/cfloop
/cfloop

CFQUERY NAME=getComps datasource=#dsn#
select * from componentstatus where setid='#attributes.setid#'
/CFQUERY

cfloop query=getcomps
cfif (getcomps.fenstatus is 'red') OR (getcomps.iavastatus is 'red') OR (getcomps.aistatus is 'red')
cfset myoverallstatus='red'

cfelseif (getcomps.fenstatus is 'green' and getcomps.iavastatus is 'green' and getcomps.aistatus is 'green')
cfset myoverallstatus='green'

cfelseif (getcomps.fenstatus is 'yellow' OR getcomps.fenstatus is 'green') and (getcomps.iavastatus is 'yellow' OR getcomps.iavastatus is 'green') and (getcomps.aistatus is 'yellow' OR getcomps.aistatus is 'green')

cfelse
cfset myoverallstatus='cyan'
/cfif

cfquery datasource=#dsN#
update componentstatus set Overallstatus='#myoverallstatus#' where setid='#attributes.setid#' and comptype='#i#'
/cfquery
/cfloop
hr
cfloop query=getsets
CFQUERY NAME=getComps2 datasource=#dsn#
select setid,overallstatus from componentstatus where setid='#attributes.setid#'
/CFQUERY
!---create list and loop over list looking for red, then yellow and finally greens---

cfset StatusList=valuelist(getcomps2.overallstatus)
cfloop query=getcomps2
cfif len(statuslist) is 0
cfset MySetoverallstatus='green'
cfelse
	cfif ListContainsNoCase(statuslist, 'red')
	cfset MySetoverallstatus='red'
	cfelseif ListContainsNoCase(statuslist, 'yellow')
	cfset MySetoverallstatus='yellow'
	cfelse
	cfset MySetoverallstatus='green'
	/cfif
/cfif
/cfloop
cfquery datasource=#dsn#
update TMSSets SET Overallstatus='#mysetoverallstatus#'
where tmssetid='#attributes.setid#'
/cfquery

TMSStatusColor - the first custom tag that the one above calls...

cfset dsn=#caller.dsn#
cfif attributes.type is not 'TACLANE'
cfquery name=getsoftware datasource=#dsn#
select * from dmssoftwarebaseline where dmscomponent='#attributes.type#'
/cfquery
cfset THECriteria=

cfloop query=getsoftware
cfset statusbackground=orange
cfset TheSoftware=Getsoftware.DMSComponent  getsoftware.DMSProduct
cfset thecriteria=TheSoftware  '='    'yes'    ' OR '  TheCriteria
/Cfloop
cfset thecriteria=left(Thecriteria, len(thecriteria)-4)
cfset Thecriteria='('  TheCriteria  ')'
cfset THecriteria= thecriteria  ' and (Fens.Status = ''Closed. Applicable to TMS''
and FenFinal.finalrecommendation=''Closed. Applicable to TMS''
and Fens.Fennumber=Fentestlabreview.fennumber 
AND FENs.FENNumber NOT IN (select FENNUMBER 
			from FEN2COmponent 
			where TMSSETID=''#attributes.setid#'' 
			AND DMSCOmponent=''#attributes.type#''))'	

cfquery name=getfens datasource=#dsn#
select FENs.fennumber, FENTestlabReview.InstallNLTDate
from Fens, FenTestLabReview, FENFinal
where #preservesinglequotes(TheCriteria)# 
/cfquery
cfset caller.FENstatusbackground=orange
	cfif getFENs.recordcount is 0
	cfset caller.FENStatusBackground=green
	
	cfelse
		Cfloop query=getFENs
		cfset CompareDate=DateCompare(getFENs.installnltdate, now(), 'd')
			cfif CompareDate LT 0
			cfset caller.FENStatusBackground=red
			cfbreak
			Cfelseif comparedate gte 0
			cfset caller.FENStatusBackground=Yellow
			/cfif
		/Cfloop
	/cfif
cfelse
cfset caller.FENstatusbackground=green
/cfif
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




nesting custom tags

2004-04-08 Thread Jennifer Knoblock
I have a custom tags that calls other custom tags they are work individually, but I need some help getting them to work altogether. 

Ideally, the parent tagruns a query and loops over the other three child tags and fills in their attribute values with results from the query. The child tags run their update queries and return to the parent tags that then doe sthe final arithmetic and returns a value to the calling page. 

But, my child tags won't run. It says the attribute is undefined.

What am I missing? 

My server is running CF 4.5, so CFCs and UDFs are not an option.
Thanks!
Jen
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: nesting custom tags

2004-04-08 Thread Raymond Camden
If I read you correctly, you want the parent tag to update attributes sent
to the child tag. You need to switch it around though. The parent can set
data that the child tag can read using getBaseTagData().
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: nesting custom tags

2004-04-08 Thread Burns, John D
Can you give some example code?Are you using cfinclude or
cfmodule?What attributes are the tags expecting?Sounds like you're
just not passing the expected attributes. From what it sounds like,
you'd want to do something like this:

PARENT TAG
cfoutput query=foo
	cfmodule template=child1.cfm variable1=#var1#
	cfmodule template=child2.cfm variable2=#var2#
	cfmodule template=child3.cfm variable3=#var3#
/cfoutput 

CHILD1
cfquery datasource=#dsn#
	update tables
	set var1=#attributes.var1#
/cfquery

CHILD2
cfquery datasource=#dsn#
	update tables
	set var2 = #attributes.var2#
/cfquery

CHILD3
cfquery datasource=#dsn#
	update tables
	set var3 = #attributes.var3#
/cfquery

John Burns

-Original Message-
From: Jennifer Knoblock [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 08, 2004 3:34 PM
To: CF-Talk
Subject: nesting custom tags

I have a custom tags that calls other custom tags they are work
individually, but I need some help getting them to work altogether. 

Ideally, the parent tagruns a query and loops over the other three
child tags and fills in their attribute values with results from the
query. The child tags run their update queries and return to the parent
tags that then doe sthe final arithmetic and returns a value to the
calling page. 

But, my child tags won't run. It says the attribute is undefined.

What am I missing? 

My server is running CF 4.5, so CFCs and UDFs are not an option.
Thanks!
Jen
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: nesting custom tags

2004-04-08 Thread Dave Watts
 I have a custom tags that calls other custom tags they are 
 work individually, but I need some help getting them to work 
 altogether. 
 
 Ideally, the parent tag runs a query and loops over the 
 other three child tags and fills in their attribute values 
 with results from the query. The child tags run their update 
 queries and return to the parent tags that then doe sthe 
 final arithmetic and returns a value to the calling page. 
 
 But, my child tags won't run. It says the attribute is undefined.

I'm not sure what exactly you mean by nested custom tags - it sounds like
you're actually calling one custom tag from within another, but that's not
what people generally mean by nested custom tags. For example, you might
have something like this:

cf_foo attribute=value
	cf_bar attribute=value
	cf_bar attribute=value
/cf_foo

In this nested custom tag example, the CF_BAR custom tag isn't being called
by CF_FOO, but rather by the same page that calls CF_FOO. However, these
custom tags can share variables in various ways - any attributes passed to
either instance of CF_BAR can be associated with CF_FOO using CFASSOCIATE,
and CF_BAR can read attribute values received by CF_FOO using
GetBaseTagData().

In any case, you'll probably have to post the code for the custom tag calls,
as well as for the custom tags themselves, to get a useful answer.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: nesting custom tags

2004-04-08 Thread Jennifer Knoblock
Can you give some example code?

!---parent tag---
query to get value

loop query !---figure individual component status in each of three areas---

cf_childtaga attribute1=#query.value1#
cfquery updates table with values from childtag a

cf_childtagb attribute1=#query.value1#
cfquery updates table with values from childtag b

cf_childtagc attribute1=#query.value1#
cfquery updates table with values from childtag c

end loop

another loop !---figure components overall status based on status of three areas calculated above---
query processes new inserted values and creates another new value

query updates another table with the new value
end loop

another loop !---figure sets overall status based on the status of the compoents it contains---
query processes new inserted value and processes another new value

query updates another table with the new value
end loop
!---end parent tag---

The attributes the child tags are expecting is a setid and a component type each. I didn't use cfinclude becuase I didn't think I could pass attributes to it. What's cfmodule?
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: nesting custom tags

2004-04-08 Thread Jennifer Knoblock
Actually, I think I want it to run both ways. I want the parent tag to set the child tags attributes and then for the child tag use those attribute sto create a new value and to send the new to the parent tag for updating and further calculating. 

Did I just ask for too much?

If I read you correctly, you want the parent tag to update attributes sent
to the child tag. You need to switch it around though. The parent can set
data that the child tag can read using getBaseTagData().
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: nesting custom tags

2004-04-08 Thread Jennifer Knoblock
Oops. Okay, I should probably get the semantics right. (:

Will the 'sorta' code I posted in rplky to the previous post work?

 I have a custom tags that calls other custom tags they are 

I'm not sure what exactly you mean by nested custom tags - it sounds like
you're actually calling one custom tag from within another, but that's not
what people generally mean by nested custom tags. For example, you might
have something like this:

cf_foo attribute=value
	cf_bar attribute=value
	cf_bar attribute=value
/cf_foo

In this nested custom tag example, the CF_BAR custom tag isn't being called
by CF_FOO, but rather by the same page that calls CF_FOO. However, these
custom tags can share variables in various ways - any attributes passed to
either instance of CF_BAR can be associated with CF_FOO using CFASSOCIATE,
and CF_BAR can read attribute values received by CF_FOO using
GetBaseTagData().

In any case, you'll probably have to post the code for the custom tag calls,
as well as for the custom tags themselves, to get a useful answer.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: nesting custom tags

2004-04-08 Thread Dave Watts
 !---parent tag---
 query to get value
 
 loop query !---figure individual component status in each 
 of three areas---
 
 cf_childtaga attribute1=#query.value1# cfquery updates 
 table with values from childtag a
 
 cf_childtagb attribute1=#query.value1# cfquery updates 
 table with values from childtag b
 
 cf_childtagc attribute1=#query.value1# cfquery updates 
 table with values from childtag c
 
 end loop
 
 another loop !---figure components overall status based on 
 status of three areas calculated above--- query processes 
 new inserted values and creates another new value
 
 query updates another table with the new value end loop
 
 another loop !---figure sets overall status based on the 
 status of the compoents it contains--- query processes new 
 inserted value and processes another new value
 
 query updates another table with the new value end loop 
 !---end parent tag---
 
 The attributes the child tags are expecting is a setid and a 
 component type each. I didn't use cfinclude becuase I didn't 
 think I could pass attributes to it. 

I'm sorry, but I'm finding your pseudocode quite confusing. You might want
to post the actual code.

 What's cfmodule?

It's a tag that allows you to call custom tags with a TEMPLATE attribute,
instead of using CF_. For example, assuming that foo.cfm was in the same
directory as your page, cf_foo would be equivalent to cfmodule
template=foo.cfm. The advantage of CFMODULE is simply that it allows you
to specify exactly which foo.cfm you want to use, and doesn't rely on the
custom tag directories.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]