CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Create a grid dinamically by selecting the fields you want

Print topic Send  topic

Author Message
FLB

Posts: 11
Posted: 07/10/2006, 3:43 PM

Hi everyone,
I have been breaking my head for a while with this problem, and I want to know if anybody can help me with any idea.

I want to have a search record that has all the fields available in a SQL table. By selecting with a checkbox the fields I need, I want to display a grid with the information of only those fields that I have selected. Nothing else than that.

It is some kind of a dinamic report placed in a grid, but I can't figure out how can I do it.

I really appreciate any help.

;-)
View profile  Send private message
WKempees
Posted: 07/10/2006, 3:57 PM

I just realized you use ASP as your language.
time() is a PhP thing, so I think you need Date

How you can check? Open your Search/Grid press Code and find you search
forms date field being assigned it's default value
  
       If Not FormSubmitted Then  
            If IsEmpty(s_date_from.Value) Then _  
                s_date_from.Value = Date  
 


FLB

Posts: 11
Posted: 07/10/2006, 4:24 PM

Thanks for your quick anwser, WKempees.
But I think I didn't explained clearly my problem.
I have a table with about 50 fields, most of them numeric. I need to create different grids of information from that table, by selecting which fields I must extract.

For example, if in the search box I select fields A, C, D, F, G, H and K; in the grid I expect to get exactly the information of those columns.

Thanks again for your help.
View profile  Send private message
Maybe
Posted: 07/10/2006, 4:36 PM

That’s going to take a bit of custom coding, especially if you want to create <tr> and dynamic SQL on the fly depending on how many fields are selected. This is a great site that may help with that http://www.experts-exchange.com

Good luck
WKempees
Posted: 07/10/2006, 5:13 PM

posted in the wrong discussion, sorry

"WKempees" <kempe819@planet.nl> schreef in bericht
news:e8um0h$p50$1@news.codecharge.com...
>I just realized you use ASP as your language.
> time() is a PhP thing, so I think you need Date
>
> How you can check? Open your Search/Grid press Code and find you search
> forms date field being assigned it's default value
>
  
>       If Not FormSubmitted Then  
>            If IsEmpty(s_date_from.Value) Then _  
>                s_date_from.Value = Date  
> 
>

WKempees
Posted: 07/10/2006, 5:26 PM

Check out MultiCheckboxList.
in the Search form put a CheckboxList.
For the DataSource you need to build either a List of Values, putting in
nr,fieldname by hand (this is the easy way) or
build an SQL retreiving field names from the table at hand.

In the Grid BeforeExecuteSelect parse the array containing the checked
fields and build the SQL dynamically
using the datasource->SQL parsing each value from the array into your SQL
SELECT probably in a concatenate to add some spacing.
Displaying the result as one large string, building your own caption on the
fly.
Don't ask me to do it because you will be charged.
Also if you want to check the fields and do operations on each field against
user supplied values, I sign off before hand, you should use a third party
reporting tool.

Walter



"FLB" <FLB@forum.codecharge> schreef in bericht
news:644b2d8178a654@news.codecharge.com...
> Hi everyone,
> I have been breaking my head for a while with this problem, and I want to
> know
> if anybody can help me with any idea.
>
> I want to have a search record that has all the fields available in a SQL
> table. By selecting with a checkbox the fields I need, I want to display a
> grid
> with the information of only those fields that I have selected. Nothing
> else
> than that.
>
> It is some kind of a dinamic report placed in a grid, but I can't figure
> out
> how can I do it.
>
> I really appreciate any help.
>
> ;-)
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

DonB
Posted: 07/10/2006, 5:41 PM

I would create a checkbox list (let's assume you name it CheckboxList1) with
each of the possible column names. This would be in a Search form, the
standard Search form that CCS builds.. When the 'Search' button is clicked,
this will send the checked items in the POST data. The items will be in
Request.Form("CheckboxList1").

Now you can write a for...next loop:

items = Request.Form("CheckboxList1")
tr = "<tr>"
for each item in items
tr = tr & "<td> & myDataSource.fields(item) & "</td>"
next
tr = tr & "</tr>"

This is greatly simplified, but you should get the general idea.

Now you put a Label control into the grid, replacing everything between the
<!-- BEGIN Row --> and <!-- END Row --> template markers and set it's data
type to 'HTML'.

Last, in the Before Show Row event of the grid, execute your for...next and
assign the label the final value of the variable 'tr':

Label1.Value = tr

This will dynamically build the columns and contruct the 'inner' part of
your table, with the columns of data. THe <table> and </table> will be
supplied directly from the html template file, so you don't need to code
them. With varying columns, having Sorters is something you'll not be able
to do (without a lot more effort than what I'm outlining here).

Take the above as a guide and not a cookbook solution. I haven't detailed
everything, and my brain is full of PHP thus the ASP is somewhat faded right
now, so I've no guarantee my syntax is on the mark (I omitted 'Dim'
statements, for example). But you should see the 'plan of attack' clear
enough to procede to a working solution.

It's actually much easier to do than it is to explain it in words.
--
DonB

http://www.gotodon.com/ccbth


"FLB" <FLB@forum.codecharge> wrote in message
news:644b2e191ec0d2@news.codecharge.com...
> Thanks for your quick anwser, WKempees.
> But I think I didn't explained clearly my problem.
> I have a table with about 50 fields, most of them numeric. I need to
create
> different grids of information from that table, by selecting which fields
I
> must extract.
>
> For example, if in the search box I select fields A, C, D, F, G, H and K;
in
> the grid I expect to get exactly the information of those columns.
>
> Thanks again for your help.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

FLB

Posts: 11
Posted: 07/10/2006, 6:12 PM

Great information, guys.
Thanks a lot.

I'm gonna try to do it as you told me, and let you know if I can get it done.

____

Frank
View profile  Send private message

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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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