Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

variable names including hyphens

Posted on 2001-06-15
2
Medium Priority
?
221 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 600 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

886 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