Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding expressions in the view designer
Message
From
08/08/2001 18:44:43
 
 
To
08/08/2001 16:52:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00541561
Message ID:
00541609
Views:
12
>Hi all...
>Im trying to build a view to populate a grid with it.
>I need the view grouped by Names, and then COUNT certain values for each group of Names.
>
>Its a single table view. In the Functions and expressions field I try to enter this: COUNT all for status='Free'. When adding that expression to the fields list, VFP adds " " to the beginning and end of the expression.
>
>What is the correct way to add one or several Count for X='Y' expressions to a view in the view designer?
>TIA
> Ulises

Couple of things:

First and foremost:

You can't use the COUNT command in a view. You'd have to use the Count() aggregate function.
Is the count the only thing you want in there? If so, see below for my answer.


Second:

I would like to post a big message somewhere that all VFP developers can see that says don't use the view designer < g > It sucks, plain and simple. or rather it's too basic...nah, it sucks.

eView in the files section here is good.

You can do it in the view designer, but why?
It's just as easy to create one in code with create sql view.
e.g.,(you can do this right in the command window)
Open Database mydatabase
Create SQL View myview As Select Count(*) As statCount From mytable Where status='Free'
Or if you want a view that you can use for different statuses:
Open Database mydatabase
Create SQL View myview As Select Count(*) As statCount From mytable Where status=?vpcStatus
to use that one,
Open Database mydatabase
vpcStatus = 'Free'
Use myview
vpcStatus = 'Captured'
Requery("myview")
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform