Solved

variable names including hyphens

Posted on 2001-06-15
2
213 Views
Last Modified: 2013-12-24
Hi Folks,

i am up against a problem involving variable names with hyphens.  unfortunately it is not as simple as redefining the variables without hyphens because these come out of active directory LDAP queries.

the basic script is like:

=========================================================
<cfoutput>
<cfset attributes = "dn,E-mail-Addresses">

<CFLDAP NAME="ListAccounts"
    SERVER="#server#"
    PORT="389"
    USERNAME="#NT_DOM#\Administrator"
    PASSWORD="#passwd#"
    ACTION="query"
    START="CN=Recipients,dc=company,dc=com"
    SCOPE="OneLevel"
    ATTRIBUTES="#Attributes#"
    TIMEOUT="320"
    >

found #listaccounts.recordcount# entries.

<p>List of Entries:<br>
<table>
<tr>
<cfloop list="#attributes#" index="att">
<td>#att#</td>
</cfloop>
</tr>
<cfloop query=listaccounts>

<tr>
<cfloop list="#attributes#" index="att">
<td>#evaluate("listaccounts.#att#")#</td>
</cfloop>
</tr>

</cfloop>
</table>

</cfoutput>
=========================================================

which produces the quite predictable error:

=========================================================
An error has occurred while processing the expression:

listaccounts.E-Mail-Addresses

Error resolving parameter LISTACCOUNTS.E
=========================================================

anyone aware of a work-around to this problem?

cheers.


0
Comment
Question by:meverest
2 Comments
 
LVL 4

Accepted Solution

by:
CF_Spike earned 150 total points
ID: 6198494
You can normally get around this by using array notation instead of dot notation to access the variable.

i.e. #evaluate("listaccounts.#att#")# can be rewritten as #listaccounts['att'][listaccounts.currentrow]# when looping through the query.

Spike
0
 
LVL 37

Author Comment

by:meverest
ID: 6200494
Thanks,

specifically, this diod the trick:

<td>#listaccounts['#att#'][listaccounts.currentrow]#</td>

Cheers.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question