From: emin on
Hi Steve,

Thanks a lot for your assistance !

> Are you sure the function is being called??

I placed the famous Logit(cVal) [from Paul Piko] in the func and
have checked that every single record of the BDF was processed and the
correct value was return

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

Yes it is correct

> What's the length of the COLOR_ID field??

9 Characters

> Maybe you need to trim the result before passing it into the function or
> before testing it in the function.

I have tested to place Padr() in the func and also in the
CreateOrder() Method

> 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

Just to prepare a demo Func I did not show DEFINE values, but of
course each colorID has its own Define.

Ernesto
From: Sandi on
Just an idea:
Why do you PAD it to 10, instead to 9, which is field length?

Regards,
Sandi
"emin" <eminffsol(a)gmail.com> je napisal v sporocilo
news:e37b4375-c51c-48fb-88a3-edda9eb0a2a2(a)q16g2000yqq.googlegroups.com ...
> Hi Steve,
>
> Thanks a lot for your assistance !
>
>> Are you sure the function is being called??
>
> I placed the famous Logit(cVal) [from Paul Piko] in the func and
> have checked that every single record of the BDF was processed and the
> correct value was return
>
>> Are you sure that the COLOR_ID is correct in the database??
>
> Yes it is correct
>
>> What's the length of the COLOR_ID field??
>
> 9 Characters
>
>> Maybe you need to trim the result before passing it into the function or
>> before testing it in the function.
>
> I have tested to place Padr() in the func and also in the
> CreateOrder() Method
>
>> 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
>
> Just to prepare a demo Func I did not show DEFINE values, but of
> course each colorID has its own Define.
>
> Ernesto

From: emin on
Hi Sandi

> Just an idea:
> Why do you PAD it to 10, instead to 9, which is field length?

The color names returned by the func are even longer than 10. I put 10
in the example just to show the expression. The field length is
fixed=9

Regards
Ernesto



From: Johan Nel on
Emin,


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

Not sure about your compiler settings but the above with my settings will
throw a compiler error that it does not know COLOR_ID.

What happens if you omit the codeblock and just pass the string
representation?

Otherwise do you maybe have a DEFINE COLOR_ID in your application that it
picks up. Also try {|| ColorNom(_FIELD->COLOR_ID)} for the codeblock
parameter.

Regards,

Johan Nel
Pretoria, South Africa.
From: Geoff Schaller on
Ernesto.

I don't think this is a very wise idea at all. You would be much better
off indexing directly off color_id and arranging the Ids accordingly.
Alternately, use a custom index. But I think Johan is closest to the
real issue.

Geoff



"emin" <eminffsol(a)gmail.com> wrote in message
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