CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Navigator Trouble with modified query

Print topic Send  topic

Author Message
rbaldwin

Posts: 172
Posted: 03/07/2007, 7:09 AM

i have a grid
i've modified my query in the beforeExecuteSelect event because my WHERE is rather complicated and i found query builder couldn't handle it. (unless some one can offer a suggestion)

the records displayed on my grid are correct and correspond to my modified query. However, my navigator seems to be ignoring my modified query. As an example. with out modifying my query there are about 300 rows on 30 pages.

with the modified query, there should only be 8 rows, but my navigator still is showing page 1 of 30. on the fist page the 8 rows are displayed, on subsequent pages no rows are displayed. I should only have page 1 of 1.:-/
View profile  Send private message
ejay

Posts: 17
Posted: 03/07/2007, 7:42 AM

I have seen such a behaviour, although i was not targetting .net but php.

the reason was : when you modify the query within the before executeselect you do it by code, acccessing the SQL property of the data source. You must not forget also to modify the countsql property that is used to count the records in your query

CCS Documentation in http://docs.codecharge.com/studio31/html/ProgrammingTec...ifySQL.html?toc shows how to modify the sql statement of the query.

there is also a data source property for .net described in http://docs.codecharge.com/studio31/html/Components/RTP...Source.html?toc

From there you may perhaps access the sql statement that does the counting.

Hope that helps.

_________________
Eric Jay
web solutions using CodeCharge studio
View profile  Send private message
rbaldwin

Posts: 172
Posted: 03/07/2007, 7:52 AM

Thanks,

I suspected as much, and do see how in the help to modify the countsql property for asp or php but not for .net.

I've also tried an alternate approach that doesn't involve custom sql but isn't working for me either

I have a grid
I also have set a session variable (myList) to contain the string "5,9" or some other list of integers depending upon who is logged in.

in the query builder for the grid, i have a single WHERE clause.

the details of which are
ConditionType = Parameter
Field= FieldA, type = integer
Condition= IN
Parameter = myList
type = Session

After publishing i now get this error

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
View profile  Send private message
ejay

Posts: 17
Posted: 03/07/2007, 8:08 AM

I am just guessing here because I have no experience of .net with CCS. The "<% ... %>" in the "....because the control contain.." error message suggests that the .aspx page generated by CCS contains a reference to the mylist session parameter within a "<% ... %> construct.

Try to change the "type" from "Session" to "Expression" in your parameter definition and put the string "5,9" in the value and see what happens, just for the sake of understanding more.

What you may also try is to build a public function (ie in VB or C#) that returns that string you get from a session variable and, with a parameter type of Expression, call that function.

Again, just guessing
_________________
Eric Jay
web solutions using CodeCharge studio
View profile  Send private message
rbaldwin

Posts: 172
Posted: 03/07/2007, 10:23 AM

When i changed the type from Session to Expression, but leaving the name as "CreateList" which was the session variable's name, clicked ok, back to query builder, then tried to see what data would be selected by clicking on the 'show data" icon in query builder, query builder complained that "CreateList" was an invalid column name, when i clicked on the 'show sql' icon, "CreateList" was not part of the query - so i find this a little confusing.

So, instead of Condition Type ->Parameter i switched to Condition type ->Expression
and hard coded my expression as FldA in (4,10),

I got exactly what i need - the correct selected subset of rows AND my grid navigator is working correctly.

SO, my question remains how do i pass my list to the query? Am i incorrecly passing it as a session variable??? if so, what is the correct way

View profile  Send private message
ejay

Posts: 17
Posted: 03/08/2007, 2:29 AM

I suppose you try to pass in your parameter in the query designer.

Idea1: Why not try to replace FdlA in (4,10) by FldA in {Param} where Param would by defined in the parameter list of the query, as an Expression parameter which takes its value from a VB or C# public function

Idea 2 : if you target SQL Server as a database try to define in SQL server a table valued function ('allowedFldATable') having the user id as a parameter and returning a single column table containing the list of all 'FldA' values allowed for the giving user id; then adapt your sql statement to be an inner join on sourcetable.Flda=allowedFldATable(userid).FldA ; then, in the query designer, define the userid as a parameter
_________________
Eric Jay
web solutions using CodeCharge studio
View profile  Send private message
Stan
Posted: 03/08/2007, 11:22 PM

Quote rbaldwin:
SO, my question remains how do i pass my list to the query? Am i incorrecly passing it as a session variable???

Looks like yes. Try to use the array instead of comma separated string. I.e you should initialize your session variable as following

  
Session["myVar"] = new int[]{5,9};  
Davis
Posted: 03/28/2007, 8:31 PM

http://83dc19ee57b84580f13cdcf7a4feb601-t.yj5t4hd.info <a href="http://83dc19ee57b84580f13cdcf7a4feb601-h.yj5t4hd.info">83dc19ee57b84580f13cdcf7a4feb601</a> [url]http://83dc19ee57b84580f13cdcf7a4feb601-b1.yj5t4hd.info[/url] [url=http://83dc19ee57b84580f13cdcf7a4feb601-b2.yj5t4hd.info]83dc19ee57b84580f13cdcf7a4feb601[/url] http://83dc19ee57b84580f13cdcf7a4feb601-b3.yj5t4hd.info ebb85e520deadfe8ff7080af84ede8f8

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.