Highlighted

How to put values in list with single quotation

Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

<cfquery name="getSelectedPriorityList" datasource="#application.datasource#" username="#application.datasource_username#" password="#application.datasource_password#">

  SELECT  id, name

  FROM  lrp,  p

  WHERE lrp.id = p.id

  AND lrp.ra_id = 123

  AND lrp.id in (#form.assignedPriority#)

</cfquery>

<cfset nickname_list=Valuelist('getSelectedPriorityList.name')>

If I run above code the value of nickname_list =  Send Certificate Invitation,View Certificate,Allow Key Recovery

but

I am in need the output as nickname_list =  'Send Certificate Invitation','View Certificate','Allow Key Recovery'

Kindly let me know what exactly I need to do to generate above output.Thanks in Advance

Views

134

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to put values in list with single quotation

Community Beginner ,
Feb 08, 2016

Copy link to clipboard

Copied

<cfquery name="getSelectedPriorityList" datasource="#application.datasource#" username="#application.datasource_username#" password="#application.datasource_password#">

  SELECT  id, name

  FROM  lrp,  p

  WHERE lrp.id = p.id

  AND lrp.ra_id = 123

  AND lrp.id in (#form.assignedPriority#)

</cfquery>

<cfset nickname_list=Valuelist('getSelectedPriorityList.name')>

If I run above code the value of nickname_list =  Send Certificate Invitation,View Certificate,Allow Key Recovery

but

I am in need the output as nickname_list =  'Send Certificate Invitation','View Certificate','Allow Key Recovery'

Kindly let me know what exactly I need to do to generate above output.Thanks in Advance

Views

135

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 08, 2016 0
LEGEND ,
Feb 08, 2016

Copy link to clipboard

Copied

You _should_ be using CFQUERYPARAM for the values, just for security.  However, the CFQUERYPARAM has an attribute "list" that might fix it.  If not by itself, you might be able to use QuotedValueList().

HTH,

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 1
Community Beginner ,
Feb 09, 2016

Copy link to clipboard

Copied

list attribute worked perfectly..Thanks a lot for the response

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 09, 2016 1
Most Valuable Participant ,
Feb 08, 2016

Copy link to clipboard

Copied

How are you using nickname_list later in your code?  Why does it need to be single-quote delimited?  You might also considering storing the value in an array rather than a list, depending on how you use it later.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2016 0
Community Beginner ,
Feb 09, 2016

Copy link to clipboard

Copied

Thanks a lot

Carl Von Stetten

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 09, 2016 0