我编写了一个数据库查询来提取ColdFusion中的信息,我想知道如何将值传递给WHERE子句以获取相关数据.这是我的代码示例.任何人都可以帮忙吗?
<cfquery name="FILM_STRIP_QUERY" datasource="#dsn#">
select distinct tm.id as teachingmoduleid,
(select concat(prs.first_name, ' ',prs.last_name) AS Video_presenter from presentations pss
inner join topics tpcs on tpcs.id = pss.topic_id
inner join presenters prs on prs.id = pss.presenter_id
where pss.name = ps.name
and tpcs.title = tp.title
) AS video_presenter,
(select pss.43_png from presentations pss
inner join topics tpcs on tpcs.id = pss.topic_id
inner join presenters prs on prs.id = pss.presenter_id
where pss.name = ps.name
and tpcs.title = tp.title) AS png_name
from teaching_modules tm
inner …Run Code Online (Sandbox Code Playgroud) 使用ColdFusion,我想将camelCase字符串转换为人类可读的字符串,如:
firstName - >名字
此外,理想情况下,这将完成所有内联,例如Ucase(rereplace('myCamelCaseString',[regex]," ")).如果内联不可能,那么UDF也许呢?
这是ColdFusion中的一个似乎应该如此简单的事情......但我找不到简单的道路.
我有一系列的清单.该数组可以是任何大小,每个列表的长度可以是任何大小.(这可以被操纵成一个多维数组,无论......重点是,我有一个列表列表)
例如
129128127
130131132
135133134
137138136
140139
141,142
或者简短的版本......它可以变化
13,14,15
11,12
我需要的是一个数组,查询或一些其他数据结构,包含所有可能的唯一组合,从每个列表中按顺序取一个...所以对于短版本,将有6个独特的组合.对于第一个较长的例子,我们将有3*3*3*3*2*2 = 324个独特的组合.
计算它们很容易......但是以结构化格式获得实际组合的最佳方法是什么?一定要错过一些简单的事情......我已经好几个小时了!: - /
这可能是一个愚蠢的问题,但我想知道ColdFusion 10中添加structClear(session)的sessionInvalidate()功能和添加的功能究竟有什么区别?
无法从Solr集合中删除文件中的密钥.
使用以下方法更新Solr集合:
<cfoutput query="fileQuery">
<cfset theFile = defaultpath & "#fileID#.pdf" />
<cfif fileExists(theFile)>
<cfindex
action="update"
collection="file_vault_solr"
type="file"
key="#theFile#"
title="#documentName#"
body="fileNumber,documentName"
custom1="/filevault/#filealias#"
custom2="#fileNumber#"
custom3="#documentName#"
>
</cfif>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
但是,当尝试从目录中删除密钥时,它根本不起作用.这是用于(尝试)删除密钥的代码:
<cfoutput query="deletedFile">
<cfset theFile = defaultpath & "#fileID#.pdf" />
<!--- Remove the deleted file from the collection. --->
<cfindex
collection="file_vault_solr"
type="file"
action="Delete"
key="#theFile#"
>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
但是,密钥不会被删除.唯一有效的方法是清除整个目录并重新索引所有文档.
任何见解?
我有一个查询,我试图添加最终输出的单个值.
这是查询
<cfloop query="score">
<cfset scorefinal = score * answerweight>
<cfif getCategories.surveyidfk eq score.surveyidfk and getCategories.categoryidfk eq score.categoryidfk>
<cfset result = getcategories.cweight * scorefinal>
<cfdump var="#result#">
</cfif>
</cfloop>
Run Code Online (Sandbox Code Playgroud)
此代码输出1.5 2.5 1.3
我需要一个方法,将这些值添加到另一个变量中,这将允许我在最后只显示一个值.
我想将这些值存储在一个数组中,然后添加数组的元素,但我很确定有一种更快,更简单的方法.
我有一个.csv,我需要转换为coldfusion查询.我使用了cflib.org CSVtoQuery方法,它工作得很好......但......
如果csv中有一个"单元格",其中包含字符串中的逗号(例如列表),则该记录的查询行会因为它将字符串中的逗号视为新值而变得混乱.
我无法控制数据是如何进入的,因此我无法在引号等内部编写或传递数据.
有没有人知道是否有办法处理可能在值中有逗号的.csv(转换为查询或其他可行的结构)?
我正在尝试使用POST方法将值从PHP传递到ColdFusion页面.它实际上是一个只有一个文本字段和提交按钮的表单.问题是如何在ColdFusion页面上"捕获"该值以在SQL SELECT语句中使用它.
PHP页面:
<form action="adminlog.cfm" method="post">
<input type="text" name="admin" placeholder="Admin" required >
<input type="submit" value="admin"/>
</form>
Run Code Online (Sandbox Code Playgroud)
ColdFusion页面:
<cfif Form.admin NEQ "">
Client ID is still #Form.ClientID#
<cfelse>
No value supplied for ClientID
</cfif>
<cfquery name='myQuery' datasource='MyDSN'>
SELECT * FROM admin WHERE aID = <cfparam name="Form.admin" />
</cfquery>
Run Code Online (Sandbox Code Playgroud)
我得到的只是:
执行数据库查询时出错.在线
Run Code Online (Sandbox Code Playgroud)<cfquery name='myQuery' datasource='MyDSN'>
如果我从SELECT语句中删除WHERE条件id显示数据库中的记录没问题.所以我猜它与传递参数有关.
我写了这种类型的ColdFusion代码已经有一段时间了,因此问题就出现了.
我将.NET Web服务中的值返回到ColdFusion中.webservice返回一个字符串数组.以下代码......
<cfoutput>
<cfset xArrayItems=#GetRequestedUserSettings.settingValues.getString()#>
<cfset xLen=ArrayLen(GetRequestedUserSettings.settingValues.getString())>
<cfloop index="x" from=1 to="#xLen#">
#xArrayItems[x]#<br />
</cfloop>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
得到以下输出...
maxsize=50
isdomainadmin=False
seenwelcome=False
Run Code Online (Sandbox Code Playgroud)
我想将这些名称/值对放入一个有意义的结构中,以便我可以在代码中进一步引用它们.我实际上需要将它们作为cfinvokearguments传递给下一个webservice调用.
请问有人能够提醒我如何在CF8中做到这一点吗?我发现的大部分内容都涉及更新的版本.
想知道是否可以在 ColdFusion 中使用“console.log”代码?
我已经部署了以下代码,但没有效果:
<cfif isDefined("placementCategoryID")>
console.log('Placement Category ID is: ' + placementCategoryID);
<cfif placementCategoryID GT 0>
Run Code Online (Sandbox Code Playgroud)
和
<cfif isDefined("categoryDto")>
console.log('Category DTO is: ' + categoryDto);
Run Code Online (Sandbox Code Playgroud)
作为示例,但它们似乎没有达到预期的效果,并且结果没有出现在 Chrome 的开发工具窗口中。
如果这是一个基本问题,我们深表歉意,但如有任何帮助,我们将不胜感激。
请注意,由于客户很难处理,我不希望弹出“警报”...需要位于 console.log 内。
coldfusion ×10
arrays ×1
coldfusion-8 ×1
coldfusion-9 ×1
console.log ×1
csv ×1
javascript ×1
list ×1
php ×1
regex ×1
solr ×1
string ×1
web-services ×1