Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing Data in a Grid
Message
De
19/08/2004 07:04:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00934445
Message ID:
00934451
Vues:
23
Neil,
Instead of playing with filters you could directly make the SQL the grid's recordsource (as you
did for combos previously). ie:
	.recordsourcetype = 4 && SQL
	.recordsource = 'SELECT * from neil INTO CURSOR crsresult'+;
                        ' where moc034 = thisform.combo1.DisplayValue'

*Combo1.InteractiveChange
with thisform.myGrid
 .recordsource=.recordsource
endwith
Cetin



>I have a form with a grid which when I open the form in the init event of the grid is a select statement which populates the grid. This works fine!
>
>I then have a combo from which when I select the option in the combo I want to filter the records in the grid. But when I select the combo option my grid returns blank.
>
>Here is my syntax:
>
>
>
>*Grid init
>
>SET DEFAULT TO 'C:\Foxpro Projects\Statistics\'
>
>SELECT * from neil INTO CURSOR crsresult
>
>WITH thisform.grid1
>	.columncount = 13
>	.recordsourcetype = 1
>	.recordsource = 'crsresult'
>	.column1.controlsource = 'key1'
>    .column1.header1.caption = 'Season'
>    .column1.width=50
>    .column1.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column2.controlsource = 'key2'
>    .column2.header1.caption = 'Dept'
>    .column2.width=50
>    .column2.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column3.controlsource = 'key3'
>    .column3.header1.caption = 'Ref'
>    .column3.width=50
>    .column3.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column4.controlsource = 'moc011'
>    .column4.header1.caption = 'Description'
>    .column4.width=300
>    .column4.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column5.controlsource = 'moc019'
>    .column5.header1.caption = 'Size'
>    .column5.width=40
>    .column5.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column6.controlsource = 'moc008'
>    .column6.header1.caption = 'Retail'
>    .column6.width=40
>    .column6.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column7.controlsource = 'round(price2,2)'
>    .column7.header1.caption = 'Cost'
>    .column7.width=40
>    .column7.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column8.controlsource = 'calcname'
>    .column8.header1.caption = 'Country'
>    .column8.width=90
>    .column8.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column9.controlsource = 'round(cr1,2)'
>    .column9.header1.caption = 'Margin'
>    .column9.width=60
>    .column9.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column10.controlsource = 'Descrip1'
>    .column10.header1.caption = 'Fabric'
>    .column10.width=80
>    .column10.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column11.controlsource = 'aconstruct'
>    .column11.header1.caption = 'Type'
>    .column11.width=50
>    .column11.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column12.controlsource = 'agauge'
>    .column12.header1.caption = 'Width'
>    .column12.width=40
>    .column12.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>    .column13.controlsource = 'round(quantity,3)'
>    .column13.header1.caption = 'Rating'
>    .column13.width=40
>    .column13.dynamicbackcolor="IIF(cr1>=-2.01,RGB(255,255,255),RGB(255,0,0))"
>ENDWITH
>
>*Combo1 Interactive change
>
>SELECT crsresult
>Set filter to thisform.combo1.DisplayValue=crsresult.moc034
>
>thisform.grid1.Refresh
>
Ç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