Tags:
create new tag
view all tags

Question

Hi,

I try to lower case the result of a ldap search using %CALC{} but "it does not work"

Wiki string in editor: $LOWER(%LDAP{base="dc=mydom,dc=net" host="myserver.mydom.net:3268" filter="&(objectClass=person)(!(extensionAttribute6=1)) (!(objectClass=computer)) (!(objectClass=contact)) (sn=H*)(sAMAccountName=v*)" format="$sAMAccountName|")}%

result(view): $LOWER(VIEAHE|VIEBHA|VIEBHO|VIEDHA|VIEDHC|

The string "VIEAHE|VIEBHA|VIEBHO|VIEDHA|VIEDHC|" is returned from %LDAP{}
Could you please help me a way to solve this problem?

FYI: in LdapPlugin.pm i have tried a small change at line 311 to get a ldap search result in one line.

original one: $rows{join('-', @sortfield{@keyfields})} .= $row . "\n";

change to: $rows{join('-', @sortfield{@keyfields})} .= $row ;

Thank you very much in advance,

Thanh.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux 2.6.24.4
Web server: Apache 2.2
Perl version: 5.8
Client OS: Window XP, service pack 2
Web Browser: Firefox 2.0.0.15
Categories: Search

-- TWikiGuest - 11 Jul 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

What happens if you escape the inner pair of '%'?

%CALC{$LOWER($percntLDAP{base="dc=mydom,dc=net" host="myserver.mydom.net:3268" filter="&(objectClass=person)(!(extensionAttribute6=1)) (!(objectClass=computer)) (!(objectClass=contact)) (sn=H*)(sAMAccountName=v*)" format="$sAMAccountName|"}$percnt)}%

I don't have LdapPlugin installed, but the same thing seems to happen here:

this doesn't LOWER
$LOWER(%LDAP{base="dc=mydom,dc=net" host="myserver.mydom.net:3268" filter="&(objectClass=person)(!(extensionAttribute6=1)) (!(objectClass=computer)) (!(objectClass=contact)) (sn=H*)(sAMAccountName=v*)" format="$sAMAccountName|")}%
but this does
$percntldap{base="dc=mydom,dc=net" host="myserver.mydom.net:3268" filter="&(objectclass=person)(!(extensionattribute6=1)) (!(objectclass=computer)) (!(objectclass=contact)) (sn=h*)(samaccountname=v*)" format="$samaccountname|"}$percnt

-- SeanCMorgan - 14 Jul 2008

Seems to be answered? Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 02 Sep 2008

Hi Sean and Peter,

Thank you very much for your reply!

I have tried it, but it did not work. TWiki return the same string which you wrote in 'but this does' section. I received the same result when I tried the command "$percntLDAP....".

Thank again, Thanh.

-- TWikiGuest - 01 Oct 2008

By default, the config field {PluginsOrder} causes the SpreadSheetPlugin to be run first. If you add LdapPlugin to the start of that string, it should run LDAP first, and then LOWER the result. And no $percnt escaping required.

Note this will affect all cases where those two plugins are used together, so check that it hasn't broken any other searches.

-- SeanCMorgan - 01 Oct 2008

Seems to be answered, closing this after more than 30 days of inactivity. Please feel free to re-open if needed.

-- PeterThoeny - 07 Nov 2008

Change status to:
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2008-11-07 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.