Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem in Sql
Message
De
24/06/1997 07:56:30
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordanie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00036374
Message ID:
00037559
Vues:
32
Thanks for your reply and sorry for delay in reply, actually the problem is if the field is other then character field, what value I should return to make it empty.

Pls Advs

>Vinod:
>
>In the first part of the code you have TotnValue=2 which is tested against in your first "if" statement in the function. The first time the function is called the first "if" evaluates .t., but the second nested "if" evaluates to .f.
>(if nvalue=totnvalue [ 1 is not equal 2 ]) so firsttime is still .t.
>
>In the example you gave, nothing below the funtion's first nested "if" statements gets executed. It looks like TotnValue should be 1, or better yet, somewhere in the function have the following code before any "return" is issued:
>
>if FirstTime
> FirstTime=.f.
>endif
>
>If I read your example correctly, lcLastCode(1) and lcLastCode(2) are always character values. You need to test for the data type before you compare:
>
>"if lcFieldValue == lcLastCode(nValue)"
>
>If the lcFieldValue is anything but character, you will get an error because I have assumed lcLastCode(nValue) is always a character.
>
>The part of the SQL that reads "HideRepValue(master.desc,2) as desc" should read
>
> "HideRepValue(master.desc,2) as 'desc'"
>
>you do need 'quotes' around desc
>
>HTH
>
>Mark
>
>>I have 2 tables :-
>>master & delivery
>>
>>I am using the below given procedure to display records from both by hiding master table's fields (by using a procedure hideval):-
>>
>>The problem is it works perfectly with character fields, but not with numerics and logical.
>>
>>Anybody can advice any corrections in the code given below :-
>>
>>Dimension lcLastCode(2)
>>
>>lclastcode=""
>> firstime=.t.
>>* lcLastCode(1) = space(6) && len for pgno - master/parent field
>>* lcLastCode(2) = space(40) && len for desc - master/parent field
>> totnvalue=2
>>test="pgno"
>> a="HideRepValue(master.pgno,1) as (test),HideRepValue(master.desc,2) as desc, " +;
>> "delivery.date, delivery.qty "+;
>> "from "+;
>> "master, delivery "+ ;
>> "where master.pgno=delivery.pgno"
>> select &a
>>
>> function HideRepValue
>> lparameter lcFieldValue, nValue
>>
>> if firstime and nvalue <= totnvalue
>> if nvalue=totnvalue
>> firstime=.f.
>> endif
>> return lcfieldvalue
>> endif
>>
>> if lcFieldValue == lcLastCode(nValue)
>> return space(len(lcFieldValue))
>> else
>> lcLastCode(nValue) = lcFieldValue
>> return lcFieldValue
>> endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform