Solved

variable names including hyphens

Posted on 2001-06-15
2
210 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now