FindValue does not return nil when no record found
Joakim Schramm
joakim at astrocalc.com
Thu May 11 01:14:11 CDT 2006
I don't get this!
I have tried to create a simple project reproducing this - but cannot. Still
I get result as below in my code for real app, and it drives me crazy! Can
devs tell if there is anything that possibly can effect this?
My code is rather simple and I can't for my life understand what causing
this.
Dim lnk As VLink
Dim bitPlaces As VBitSet
Dim bitLatPlaces As VBitSet
Dim bitLngPlaces As VBitSet
'set the link
Set lnk = mAtlasDB.Link(lnkCountryHasPlaces)
'Now get all linked places for this specific country
'and put in VBitSet object. Rec is passed Long and has RecID for tCountry
'tCountry and tPlaces declared in module level
Set bitPlaces = lnk.FindLinkedAsBitSet(Rec, tCountry, tPlaces)
'bitPlaces should have a subset of places from tPlaces table, and have.
'we want to search in bitPlaces set for the passed Long value Longitude
'and put result in bitLngPlaces
'fLangDeg is field of tPlaces, declared in module level
Set bitLngPlaces = fLngDeg.FindValue(Longitude, bitPlaces)
If bitLngPlaces Is Nothing Then
I pass a value that with guaranty not exists in table, neither in field.
Hence, bitLngPlaces is expected to Nothing (Nil), but it is not.
If I remove bitPlaces so I have fLngDeg.FindValue(Longitude)
I get Nothing as result. I try to reproduce this in simple test project,
without success.
I am stumped!
Joakim
> -----Original Message-----
> From: valentina-bounces at lists.macserve.net
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of
> Joakim Schramm
> Sent: 10 May 2006 17:45
> To: 'Valentina Developers'
> Subject: FindValue does not return nil when no record found
>
> The code
>
> Set objVset = f1.FindValue(lngVar)
>
> If no record is found give result
>
> objVset Is Nothing
>
> Well it actually leave it as Nothing
>
> The code
>
> Set objVset = f1.FindValue(lngVar, objVset2)
>
> If no record is found give result
>
> objVset Not Is Nothing
>
> I guess it, technically speaking, returns an empty set,
> initialing the object to not be nil.
>
> This is inconsistent and makes it impossible to test the
> state of the object in a proper way. It should in my opinion
> return nil (Nothing in VB).
>
> I think the same thing is true with FindValueAsArraySet()
>
> Joakim
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
More information about the Valentina
mailing list