I am beginner in coldbox , after going through simplscrud example in sample application , i started converting my application into coldbox.
i.e. making view separately calling handlers on click of any event or in the form submission , for ex like this “#event.buildLink(‘report.flag’)#/StaffId/#rc.ViewSickCalls.StaffId#”
And all the queries . bisiness logic im doing in model by passing & returning values throigh handlers.
Now my requirement is i am using output of one query inside another query and printing the result .
WHERE CallBatchId = #CallBatchId#
and printing value of #GetData1.Recordcount#
How will i implement this ? as handler will return output of first query then how will i call second query’s handler simultaneously by passing first’s result?
Please help me out in this , i am new in this.
Thanks in Advance
You could use the HTML helper, maybe as the best option and easiest to maintain.
Can you please give me an example , how to use it?
I already gone through this link , there are functions like ol , ul ,table that will produce complete table or lists isnt it? Which function you’ll suggest me if i want recordcount or just one field of the returned query?
You can create your own helpers, think of them like writing a ColdFusion template module.
That means you can write your own output, if you understand how to write a ColdFusion template module then writing a helper should be a piece of cake.
ok , i didn’t found any link on how to create own html helpers how to call them etc…will be grateful to you if you suggest one.
HTML Helpers are just plugins, you can either create a plugin that extends the core HTML helper, and then just load this up when you need it. Another way would be to look at the ColdBox code and see how the HTMLHelper plugin is made available to your views, and then copy that way of creating your own.
I just googled myself, as I thought there would be a heap of ways to show how to write your own. There are a few on how to extend the built in one though, so that might be a good guide to begin with, at least till you get a bit more adventurous.
Ok , i will try on it however have never created any plugin also , but will try to create one and get back to you if needed.
Hi Andrew ,
I tried this one by creating a cfc inside helpers folder , and putting my query inside that cfc file like this :
WHERE FacilityID = #Session.FacilityID#
AND PartnerFacilityId = #arguments.FacilityID#
and calling it from my view like this :
<cfif #getpartners(rc.facility.FacilityId)# NEQ 0>
But every time its giving me this error :
“Routines cannot be declared more than once.
The routine getpartners has been declared twice in different templates.”
i changed the name of function also but every time this same error .Can you help me out in this.
Not sure to be honest, I am wondering if the file is already getting included?
Hey it worked , actually i was putting this line inside the loop :
" <cfset includeUDF(‘helpers/poolingpartners’)>"
thats why it was showing error , now i declared it outside the loop and my code is working fine finally .