Item10936: uc() and lc() (and probably d2n() ) don't seem to work

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: DBCachePlugin
Branches: trunk
Reported By: DiabJerius
Waiting For:
Last Change By: MichaelDaum
DBCachePlugin (3.61, $Rev: 11312 (2011-04-06) $)

The docs indicate that one should be able to use $uc() and $lc() in the format parameter. However, that doesn't seem to work for me:

%DBQUERY{
web="%USERSWEB%"
topics="FidoMcGruff"
format="$uc($formfield(Email)) $lc(Email)"
}%

produces

$uc(fido.mcgruff@woof.org) $lc(Email)

Looking at the code, $uc(), $lc(), and $d2n() are implemented in WebDB::expandPath, but this seems to be called from Core::handleDBQuery only if I surround the $uc() expression with $expand().

However, the code in Core::handleDBQUERY does not properly handle nested matched parenthesis: with an input string of $expand($uc(Email)), it extracts $uc(Email and sends that on to expandPath, which fails.

I don't read the documentation as requiring the use of $expand() to get $uc(), so I'm at a loss to explain how to get $uc() and friends working.

-- DiabJerius - 30 Jun 2011

It's been a while since I used DBCachePlugin, but AFAIK lc() and friends are query functions, not formatting tokens. So they need to be written as part of a query or an $expand() expression, I guess.

Something like $expand(uc(Email))

-- PaulHarvey - 01 Jul 2011

The syntax according to the docu is:

%DBQUERY{topic="%TOPIC%" 
   format="
   * $formfield(Date)
   * $d2n(Date)
   * trunc(): $trunc(Hello World, 5)
   * $lc($expand(TopicTitle))
   * $uc(hello world)
"
}%

Diab, you are right the latter two - lc and uc - don't work as expected. d2n() operates on formfields of type date, not on string like lc, uc, flatten, trunc. That's a docu error there.

$lc() and $uc() weren't even implemented although documented.

-- MichaelDaum - 08 Apr 2013
 
Topic revision: r5 - 08 Apr 2013, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy