[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

How to get the number of selected records in a grid

babyto

2/17/2006 6:47:00 PM

Hi there does any body know how to get the number of selected records in a
grid.
For example CustTransOpen_ds.mark() does not return it. Please help. I would
like to check if the number is > 1 so that i can throw error.
43 Answers

Rob Keeris

2/17/2006 9:36:00 PM

0

I solved it like this..

In the classdeclaration

int nr; // counting records
-------------------------------------

Create a Form Method :

void Count()
{
Queryrun qr;
;
nr = 0;
qr = new queryrun(table_ds.queryRun().query());
nr = SysQuery::countTotal(qr);
}

In the tabledatasource that i want to count overuled the executeQuery and
created a displaymethod.

public void executeQuery()
{
super();
element.Count();
}

Display int nrofrec()
{
return nr;
}

I dont know if there are beter methods but this works fine for me...




"babyto" wrote:

> Hi there does any body know how to get the number of selected records in a
> grid.
> For example CustTransOpen_ds.mark() does not return it. Please help. I would
> like to check if the number is > 1 so that i can throw error.

Anton Venter

2/18/2006 12:06:00 PM

0

Have a look at this article on Axaptapedia.com
http://www.axaptapedia.com/index.php/Multiple_grid_...


"babyto" <babyto@discussions.microsoft.com> wrote in message
news:2A883D7B-909B-44F5-9BB4-F65F82C748EC@microsoft.com...
> Hi there does any body know how to get the number of selected records in a
> grid.
> For example CustTransOpen_ds.mark() does not return it. Please help. I
> would
> like to check if the number is > 1 so that i can throw error.


babyto

2/18/2006 7:11:00 PM

0

I did read this article but it still gives me i = 1 all the time
This is the code i'm using in the click method of a display menu item to see
what is the number of marked lines:

for (CustTransOpen = CustTransOpen_ds.getFirst(true) ?
CustTransOpen_ds.getFirst(true) :
CustTransOpen_ds.cursor(); CustTransOpen; CustTransOpen =
CustTransOpen_ds.getnext())
{
i ++;
}

info(int2str(i));
I don't know what the problem is,.,,,please help, I have a checkbox infront
of every record and i would like to get the number of the lines with marked
checkboxes,,,,

"babyto" wrote:

> Hi there does any body know how to get the number of selected records in a
> grid.
> For example CustTransOpen_ds.mark() does not return it. Please help. I would
> like to check if the number is > 1 so that i can throw error.

Sebastian Draese

2/18/2006 11:41:00 PM

0

sorry......
selected records in a grid are the lines in "blue", selected eg. with ctrl +
"click"

try a "select count(RecID) .... where table.checkboxfield == NoYes::Yes"
the result will be at table.recid.

bxe,
Sebastian

"babyto" <babyto@discussions.microsoft.com> schrieb im Newsbeitrag
news:4827600B-EBD0-4112-8FD7-CDC8F6206ECB@microsoft.com...
>I did read this article but it still gives me i = 1 all the time
> This is the code i'm using in the click method of a display menu item to
> see
> what is the number of marked lines:
>
> for (CustTransOpen = CustTransOpen_ds.getFirst(true) ?
> CustTransOpen_ds.getFirst(true) :
> CustTransOpen_ds.cursor(); CustTransOpen; CustTransOpen =
> CustTransOpen_ds.getnext())
> {
> i ++;
> }
>
> info(int2str(i));
> I don't know what the problem is,.,,,please help, I have a checkbox
> infront
> of every record and i would like to get the number of the lines with
> marked
> checkboxes,,,,
>
> "babyto" wrote:
>
>> Hi there does any body know how to get the number of selected records in
>> a
>> grid.
>> For example CustTransOpen_ds.mark() does not return it. Please help. I
>> would
>> like to check if the number is > 1 so that i can throw error.


babyto

2/19/2006 12:30:00 PM

0

This checkbox represents a datamethod in the form CustTransOpen called
markTrans(this a method for the datasource CustTransOpen). I tried to write
something like:
select count(recid) from CustTransOpen where CustTransOpen.checkboxvalue ==
NoYes::Yes but i don't know how to get the value of the checkbox since it's
not a field, but a method for the datasource.

"Sebastian Draese" wrote:

> sorry......
> selected records in a grid are the lines in "blue", selected eg. with ctrl +
> "click"
>
> try a "select count(RecID) .... where table.checkboxfield == NoYes::Yes"
> the result will be at table.recid.
>
> bxe,
> Sebastian
>
> "babyto" <babyto@discussions.microsoft.com> schrieb im Newsbeitrag
> news:4827600B-EBD0-4112-8FD7-CDC8F6206ECB@microsoft.com...
> >I did read this article but it still gives me i = 1 all the time
> > This is the code i'm using in the click method of a display menu item to
> > see
> > what is the number of marked lines:
> >
> > for (CustTransOpen = CustTransOpen_ds.getFirst(true) ?
> > CustTransOpen_ds.getFirst(true) :
> > CustTransOpen_ds.cursor(); CustTransOpen; CustTransOpen =
> > CustTransOpen_ds.getnext())
> > {
> > i ++;
> > }
> >
> > info(int2str(i));
> > I don't know what the problem is,.,,,please help, I have a checkbox
> > infront
> > of every record and i would like to get the number of the lines with
> > marked
> > checkboxes,,,,
> >
> > "babyto" wrote:
> >
> >> Hi there does any body know how to get the number of selected records in
> >> a
> >> grid.
> >> For example CustTransOpen_ds.mark() does not return it. Please help. I
> >> would
> >> like to check if the number is > 1 so that i can throw error.
>
>
>

Alf P. Steinbach

8/13/2009 10:37:00 AM

0

* James Kanze:
>
> .h is already used. Using it for C++ headers creates an
> ambiguity. The application associated with .h files is a C
> program editor (i.e. a program editor configured for C); syntax
> highlighting, for example, won't recognize class as a keyword,
> but will highlight it as a user symbol.

I have not experienced this problem.


Cheers,

- Alf

Victor Bazarov

8/13/2009 1:46:00 PM

0

Alf P. Steinbach wrote:
> * James Kanze:
>>
>> .h is already used. Using it for C++ headers creates an
>> ambiguity. The application associated with .h files is a C
>> program editor (i.e. a program editor configured for C); syntax
>> highlighting, for example, won't recognize class as a keyword,
>> but will highlight it as a user symbol.
>
> I have not experienced this problem.

+1

Since I don't work in C, and the [integrated] editor I use colors all
keywords the same C++ way (even the language extensions), I don't really
care. Besides, if I ever needed to code in C, why would I use a C++
keyword? Just because I can? And how? As a variable name? <shrug>

Solution: Just tell your tool that .h is a C++ source (just like .C or
..cc) and everything's gonna be easier, I think.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

Juha Nieminen

8/13/2009 4:58:00 PM

0

Victor Bazarov wrote:
> Solution: Just tell your tool that .h is a C++ source (just like .C or
> .cc) and everything's gonna be easier, I think.

Easier than what? Than naming your files logically?

Victor Bazarov

8/13/2009 5:38:00 PM

0

Juha Nieminen wrote:
> Victor Bazarov wrote:
>> Solution: Just tell your tool that .h is a C++ source (just like .C or
>> .cc) and everything's gonna be easier, I think.
>
> Easier than what? Than naming your files logically?

"Logically"? What's illogical about giving your headers the '.h'
extension? They are *h*eaders, aren't they? In the beginning I
remember giving some code fragments extensions '.inc' (it may have been
ASM or some such) because they were *inc*luded. Is that logical?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

Ian Collins

8/13/2009 7:18:00 PM

0

Juha Nieminen wrote:
> Victor Bazarov wrote:
>> Solution: Just tell your tool that .h is a C++ source (just like .C or
>> .cc) and everything's gonna be easier, I think.
>
> Easier than what? Than naming your files logically?

Boost went for .hpp, but most (if not all?) pre-standard compilers used
..h for library headers (remember <iostream.h>?).

--
Ian Collins