Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using valuearray in cfset seems like it should be obvious and easy...

Community Beginner ,
Oct 06, 2023 Oct 06, 2023

I'm trying to do the following:

 

Jim28875934wjyb_0-1696625833829.png

The query works and cfdumps 2 items as expected. valuearray fails as part of cfset set and I've tried various and sundry combinations of quotes and such with no luck. Can someone help me sort this out? The end goal is to have an array I can do an arrayFind against to see if someone gets to see a particular web app or not.

 

Tanks,

 

JimB

 

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

correct answers 1 Correct answer

Community Expert , Oct 07, 2023 Oct 07, 2023

The syntax for CFSET is

 

<cfset var = expression>

 

where the expression is any valid CF expression. If it's a literal value, it would be wrapped in double quotes, like this:

 

<cfset first_name = "Bob">

 

Dave Watts, Eidolon LLC 

Translate
Community Expert ,
Oct 07, 2023 Oct 07, 2023

The syntax for CFSET is

 

<cfset var = expression>

 

where the expression is any valid CF expression. If it's a literal value, it would be wrapped in double quotes, like this:

 

<cfset first_name = "Bob">

 

Dave Watts, Eidolon LLC 

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2023 Oct 09, 2023

Thanks Dave!

I must have been severely under-caffeinated to try and make up <cfset>var=val</cfset>

Now, I just have to figure out the cf 11 equivalent of ValueArray 😞

 

Thanks for the help,

JimB

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2023 Oct 09, 2023

In CF 11, I think you have to iterate through the query to build an array. Search for "query array ColdFusion" and you should find some simple custom functions for that.

 

Dave Watts, Eidolon LLC 

Dave Watts, Eidolon LLC
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 09, 2023 Oct 09, 2023
LATEST


`<cfset applist="ListToArray(" arraytolist(="" appqry[="" "app"="" ],"|"="" ),"|",true="" )="">`

vs

`<cfset applist="ValueArray(appqry,"app")">'

Works! Hope this helps someone else! Thanks again Dave!

 

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