From: emin on
Hi friends,

Working with VO 2.7b
When I create MyIndex.CDX all Tags are created OK except one which
includes a function in its expression. No error is shown while
creating the Index file but the Tag is not created. I have already
generated index files with Funcs and never had problems. As far as I
can see the function meets the conditions to work properly. Please
have a look and help me find where could be the problem.

oServer:CreateOrder("CatColor", ,"ColorNom(COLOR_ID)",{||
ColorNom(COLOR_ID)})

FUNCTION ColorNom(cColorID)
LOCAL cColorNom AS STRING

DO CASE
CASE cColorID=="200000032"
cColorNom := "BLACK"
CASE cColorID=="200000033"
cColorNom := "WHITE"
CASE cColorID=="200000034"
cColorNom := "RED"
ENDCASE

RETURN PadR(cColorNom, 10)

Thanks a lot in advance
Ernesto
From: Karl Wochele on
Hi Ernesto,

probably your function is simply not linked into your application. Try

EXTERNAL ColorNom

in the place where you create your tags.

HTH,
Karl

Am 15.03.2010 14:27, schrieb emin:
> Hi friends,
>
> Working with VO 2.7b
> When I create MyIndex.CDX all Tags are created OK except one which
> includes a function in its expression. No error is shown while
> creating the Index file but the Tag is not created. I have already
> generated index files with Funcs and never had problems. As far as I
> can see the function meets the conditions to work properly. Please
> have a look and help me find where could be the problem.
>
> oServer:CreateOrder("CatColor", ,"ColorNom(COLOR_ID)",{||
> ColorNom(COLOR_ID)})
>
> FUNCTION ColorNom(cColorID)
> LOCAL cColorNom AS STRING
>
> DO CASE
> CASE cColorID=="200000032"
> cColorNom := "BLACK"
> CASE cColorID=="200000033"
> cColorNom := "WHITE"
> CASE cColorID=="200000034"
> cColorNom := "RED"
> ENDCASE
>
> RETURN PadR(cColorNom, 10)
>
> Thanks a lot in advance
> Ernesto
From: emin on
Hi Karl,

The EXTERNAL statement did not produce any change.

Thank you for your input!
Ernesto
From: Massimo Bighelli on

maybe the PadR() is the problem

Massimo



"emin" <eminffsol(a)gmail.com> ha scritto nel messaggio
news:4977df67-3f7f-4b80-8b4f-6f6654eda862(a)t23g2000yqt.googlegroups.com...
> Hi friends,
>
> Working with VO 2.7b
> When I create MyIndex.CDX all Tags are created OK except one which
> includes a function in its expression. No error is shown while
> creating the Index file but the Tag is not created. I have already
> generated index files with Funcs and never had problems. As far as I
> can see the function meets the conditions to work properly. Please
> have a look and help me find where could be the problem.
>
> oServer:CreateOrder("CatColor", ,"ColorNom(COLOR_ID)",{||
> ColorNom(COLOR_ID)})
>
> FUNCTION ColorNom(cColorID)
> LOCAL cColorNom AS STRING
>
> DO CASE
> CASE cColorID=="200000032"
> cColorNom := "BLACK"
> CASE cColorID=="200000033"
> cColorNom := "WHITE"
> CASE cColorID=="200000034"
> cColorNom := "RED"
> ENDCASE
>
> RETURN PadR(cColorNom, 10)
>
> Thanks a lot in advance
> Ernesto


--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Stephen Quinn on
Ernesto

Are you sure the function is being called??

Stick a breakpoint in there and run it under the debugger.
or just do a
? 'returning ' cColornom

Are you sure that the COLOR_ID is correct in the database??

What's the length of the COLOR_ID field??
Maybe you need to trim the result before passing it into the function or
before testing it in the function.

You should also put something in cColornom in case COLOR_ID isn't one of the
3 your testing for.

You'd be better off putting those IDs into DEFINEs and use them in the test
cases.
Eg
DEFINE COLORID_BLACK := "200000032"
> CASE cColorID == COLORID_BLACK

CYA
Steve