Solved

variable names including hyphens

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

22 Experts available now in Live!

Get 1:1 Help Now