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
--
TWikiGuest - 11 Jul 2008
Answer
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