Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListBox show Elements but not .F. when nothing to be sho
Message
From
04/06/2018 05:03:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/06/2018 04:22:05
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01660530
Message ID:
01660539
Views:
61
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform