cfloop


Best way to store permissions for the user account?

空扰寡人 提交于 2020-01-24 10:14:07
问题 I have permission records that are tied to each account in my application. Each account can have one or multiple permission records based on account type. Here is example: <cfquery name="qryUserPerm" datasource="#Application.dsn#"> SELECT AccessType, AccessLevel, State, City, Building FROM Permissions WHERE AccountID = <cfqueryparam cfsqltype="cf_sql_integer" value="#trim(session.AccountID)#"> </cfquery> Query above will produce data like this for one of the accounts: RecID AccountID

Having some trouble understanding loops

独自空忆成欢 提交于 2020-01-05 08:20:28
问题 I created this for some reason neither one of the queries are being updated <cfloop index="i" from="1" to="#ArrayLen(location)#"> <cfif location[i] NEQ "" AND #locationID# EQ "" > <cfquery Name="UpdateAddActivity" DATASOURCE="#DS#"> INSERT INTO tblProjectLocations ( projectID, locationID ) VALUES ( #ProjectName#, #location[i]# ) </cfquery> </cfif> <cfif location[i] EQ "" AND #locationID# NEQ "" > <cfquery Name="UpdateAddActivity" DATASOURCE="#DS#"> DELETE FROM tblProjectLocations WHERE

Generating a total within a query loop

≡放荡痞女 提交于 2019-12-24 10:48:37
问题 I have a simple query that pulls a list of records by their ID: <cfquery name="resTotals" datasource="#datasource#"> SELECT ticket_id FROM closed_tickets WHERE YEAR(closed_date) = '2017' AND ticket_type = 'residential' </cfquery> I am then trying to loop through those ID's in another query of a different table so I can check for the existence of a payment record. The goal is to then total up all the payment records find to get a total amount in dollar of payments. I have this query to do that

Coldfusion create array from dynamic form checkboxes

蓝咒 提交于 2019-12-12 20:17:09
问题 I have a dynamic form with multiple checkboxes and on submit I want to run a CFSTOREDPROC in another cfloop using only the checkbox values that changed status. So far below is a rough concept that I am trying to test but I am sure the way I am creating my array will have issues. If anyone can provide feedback on possible solutions I would appreciate it. HTML/CF FORM: <form action="self.cfm" method="post" name="permissions"> <input type="hidden" name="User_ID" value="<CFOUTPUT>#User_ID#<

cfhttp in cfloop limit? use cfthread

风格不统一 提交于 2019-12-12 05:11:55
问题 I'm currently trying to develop an API and the stage where I'm at just now is to populate a table with a full data set (ID, first name, last name, dob etc). The way I've written this is to use a cfloop from 1 to 500,000 (as I don't know what range the IDs range from and to) and within each cfloop I call a function that makes a cfhttp request to the server and retrieve the content. I then deserialize the returned JSON, call a function to query my table to see if the current item ID already

Error with CFLoop When Entries Are Missing [duplicate]

怎甘沉沦 提交于 2019-12-11 09:08:15
问题 This question already has answers here : CFLoop Error For Missing Entries (2 answers) Closed 5 years ago . I have the following code. <cfoutput> <cfxml variable="eating"> <catalog> <results>10</results> <food id="bk101"> <initials>BK</initials> <keywords>Burger King, pie, hamburgers, fries, milkshakes</keywords> </food> <food id="bk102"> <initials>TB</initials> <keywords>Taco Bell, tacos, churros, burrito, gorditas</keywords> </food> <food id="bk103"> <keywords>Pizza Hut, pizza, cheese,

How to find the nested cfoutput recordcount when using group

痞子三分冷 提交于 2019-12-11 03:36:13
问题 Consider the following: <cfoutput query="resources" group="type"> <h4>#type#</h4> <cfoutput> #name# </cfoutput> </cfoutput> resources.recordcount would give me the total number of records, but is there an elegant way of finding out the recordcount of the nested data? e.g <cfoutput query="resources" group="type"> <h4>#type# (#noofrecords# of #resources.recordcount#)</h4> <cfoutput> #name# </cfoutput> </cfoutput> I could probably do something hacky with loops, but wondered if there was a way of

Evaluate function

我的未来我决定 提交于 2019-12-08 20:38:58
问题 Is there a better way to write the following? <cfloop list="#qry.Columnlist#" index="FieldName"> <cfset "form.#FieldName#" = Evaluate("qry.#FieldName#")> </cfloop> This loop is assigning every field in the query to a corresponding form field. I understand the evaluate function is shunned. 回答1: <cfloop list="#qry.Columnlist#" index="FieldName"> <cfset form[FieldName] = qry[FieldName][1]> </cfloop> ? 回答2: Assuming you are returning a single recordset the following will work. <cfloop list="#qry

Coldfusion Search HTML <textarea> Then Covert Base64 String To File On Server

岁酱吖の 提交于 2019-12-08 10:34:22
问题 EDIT: Replace base64 string that is in the textarea with a URL. The textarea is a WYSIWYG editor (CKEditor). I need to upload an image to the server file system. I'm trying to use this code to convert the string to an actual image and then in the textarea replacing the base64 string with the location of the image on the server (URL). <cfset image = imageReadBase64(#LocalOccurrence#)> <cfimage source="#image#" destination="#save_image_to_this_location# & #name_of_image# & #extension_of_image#"

CFLoop Error For Missing Entries

不想你离开。 提交于 2019-12-02 11:17:42
问题 please disregard this post. I have made a clearer example of my problem here: Error with CFLoop When Entries Are Missing I am running the CFLoop code below. <cfset data = queryNew("sid,firstname,lastname,age","integer,varchar,varchar,integer")> <cfloop index="x" from="1" to="50"> <cfset queryAddRow(data)> <cfset querySetCell(data,"sid",x)> <cfset querySetCell(data,"firstname","#first[x]#")> <cfset querySetCell(data,"lastname","#last[x]#")> <cfset querySetCell(data,"age","#studentage[x]#")> <

工具导航Map