Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populating a Grid based on user selected variables
Message
 
À
22/06/1997 12:13:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00037356
Message ID:
00037361
Vues:
28
>I'm trying to create a form with a 3-tabbed page frame.
>The first tab contains a graph and/or U.S. map representing a data set.
>The second tab contains a grid of that data set.
>The third tab contains a list box of line-of-business names and an option
>group of state entity criteria (State Borders, State Operations and Territories).
>
>I need to find the best way to populate the grid based on the user's selections
>from the third tabbed page.
>
>From what I've read, it seems that a parameterized view is what I need; but,
>I can't get it to work correctly.
>I've gotten the varible request dialog boxes during some attempts - I want the
>variables to be taken from the values returned by the user's selections from the
>Select Data page.
>Another attempt gave me a blank grid rectangle and yet another attempt gave me
>the grid without any data in it at all.
>
>Background Info:
>I have a table containing separate records for each state code, line-of-business
>code and year.
>
>Every state does not sell every line-of-business and some states may have started
>selling a line-of-business in different years; so, I have to create an outer-join
>with a lookup cursor created in my LOAD method consisting of a primary
>key of stcode+lobcode+cyr.
>
>Database: MIPS.DBC
>Tables: IF1.DBF
> (partial data structure)
> stcode C(3)
> lobcode C(2)
> cyr C(4)
> cmth C(2)
> prmtotinf N(10,0)
> STATES.DBF
> (partial data structure)
> stcode C(3)
> stname C(20)
> map C(4)
> LOBS.DBF
> (partial data structure)
> lobcode C(2)
> lobname C(20)
> uinf N(1,0)
>
>Cursor (after Outer-Join to add missing stcode
>and lobcode and cyr records):
> _IF1DATA (1734 records)
> stcode C(3)
> stname C(20)
> lobcode C(2)
> cyr C(4)
> cmth C(2)
> map C(4)
> y0prmtot N(10,0)
> y1prmtot N(10,0)
> y2prmtot N(10,0)
>
>View (CREATE SQL VIEW _if1rank AS ;
> SELECT stname,y0prmtot,y1prmtot,y2prmtot ;
> FROM _if1data ;
> WHERE ;
> lobcode = ?lcLOBCode AND ;
> SUBSTR(map,?lnMapPos,1) = ?lcMapType ;
> ORDER BY y0prmtot DESC):
> _IF1RANK
> stname C(20)
> y0prmtot N(10,0)
> y1prmtot N(10,0)
> y2prmtot N(10,0)


Hi, Dan:

I presume you've checked your view with pre-set variables so you know the correct data is obtained each time. Assuming the view is correct, I have three suggestions which may help.

1. You seem to be using local variables (from the 'l' at the beginning of the variable name). This may cause problems if the variables go out of scope. Use public variables and see if that helps. Getting the variable request form shows that the view can't find/use the variables you think you've given it. Remember that local variables are local to the EVENT not the FORM.

2. If your view is showing the correct data, then once you set up the grid to use the view you should only need to ReQuery() the view and Refresh() the grid for the new data to be shown. The ReQuery() event will update the view using the latest values of your variables.

3. Since you have to specify variables/parameters to the view, make a separate variable for the SUBSTR(map,?lnMapPos,1) value. This will speed things up.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform