visual studio lightswitch - Using the PreprocessQuery method in a Local Query -


i've master/detail relationship 1 shown in picture below

enter image description here

i need filter data shown in orderheaders table i've edited local query (by clicking edit query link in screen) part of filter based on computed property need use preprocessquery method because computed properties doesn't appear in query's "filter" section.

but i've problem, in local query "write code" combobox not available in global query shown in picture below

enter image description here

so don't know how create preprocessquery method in local query.

can tell me how create it?

if it's not available local queries there way filter computed property?

ok first create subquery table. such productswithoudescription , sortedproducts right clicking table , "adding query". (country supposed equivalent of "headers" table)

enter image description here

name query, add parameter query of whatever type need.

enter image description here

now write code it: (here country table i'm using)

enter image description here

enter image description here

note newparameter "parameter" method. filter query display records countryname equal parameter. can have many parameters need.

now add data item screen.

enter image description here

then add new property of type need well.(its under add data item well)

i recommend uncheck is required.

enter image description here

here basic query layout screen. used table locations example every location has country in data model. locations supposed equivalent of customer table. if expand locations(you customers) table notice can't add newly created query directly. notice property created displayed.

enter image description here

if expand new query on left youll see parameter @ bottom.

enter image description here

click on it, properties (f4) , map parameter newly created property.

enter image description here

now filtering parameter set property created.

now have set property before query can display anything. heres how it:

select customer(mine locations) table , @ top left click down arrow next write code , select `selectionchanged' method:

enter image description here

now write code:

enter image description here

here display string computed field of locations. every time select in locations grid, use "displaystring" filter "mynewfavoritequery".

some things note:

it make parameter subquery optional query display without filtering long property null. (actually im not sure 1 since im using little bit differently, can play around , see get)

enter image description here

if set property required cause validation erros on screen if property set null.

you may have fine tune property initialized null when screen created. can edit "screecreated" method under general in write code set value property when screen first generated.

let me know if have questions.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -