Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ListBox show Elements but not .F. when nothing to be sho
Message
De
04/06/2018 05:03:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/06/2018 04:22:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Divers
Thread ID:
01660530
Message ID:
01660539
Vues:
62
>>>Hi,
>>>
>>>I have a listbox, populated with an array: Thisform.aNames
>>>The list is restricted to the first 10 elements only so NumberOfElements is set 10
>>>The array is constructed in myForm with aNames[10,2]
>>>
>>>and populated with a select:
Select naw.fullname, naw.ID from NAW where  substring(fullname,1) = ? m.lcLetter into array aNames[10.2]
>>>this works fine, however, when there is not enough data to populate 10 fields the remaing are shown in the listbox as .F., how should I change to avoid this, prefer to show [ ] (nothing)
>>
>>Honestly I don't understand how that really works in the first place. I just tested thinking I might be wrong but that kind of syntax is giving me error ("SQL: Statement is invalid"). You can't really specify the array size, can you?
>>Whatever the initial size of an array is, after the select statement it would be [selected rows count, columns count].
>>
>>
>>Local array laCheck1[300,100], laCheck2[1]
>>Select * from (_samples+'data\customer') into array laCheck1
>>Select * from (_samples+'data\customer') into array laCheck2
>>
>>? Alen(laCheck1,1), Alen(laCheck1,2)
>>? Alen(laCheck2,1), Alen(laCheck2,2)
>>
>>
>>The only exception to this is when select doesn't return any rows. Then the array's original size and values are preserved.
>
>Correct, that is my case.
>When one is working with the application for the first time, there are yet no records in the tables and this will result in 10 rows with .F. which I do not like.
>So I will now parse through the array and replace all the .f. values with '' easy enough
>
>Thanks for your solution,
>
>Regards,
>Koen

Then you could simply set your array to be "" initially:
aNames = ''
Elements then would all be '' instead of .F.

However, I would repeat, SQL rowsource is the better alternative.

PS: With SQL rowsource your ID would be an INT if that is an INT, not text that you need to make unnecessary conversions.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform