start with no records selected in a form

Hello, I have this form with to 2 table boxes on it. The user is allowed to make a selection in each of the two table boxes. When he (or she ofcourse) made his/her selection, they can push a button which fires a procedure, for the selected records only (by using SetSelectionFilter). So far so good. But what happens when a user does not make any selection and pushes the button ? The procedure is carried out on two records, namely the first of each table box, which got a focus (a triangle in front of the record) when opening the form. Is there any way to prevend the selection of the first record in a table box when opening the form ? thanks for your time !

I’m not sure that I completely understand what you’re trying to do, but I think what I would do is check for the existance of some value in the record before starting the process. Maybe something like this if you’re doing something with the customer record… OnPush()… If Customer.“No.” = ‘’ then error(‘You did not choose a customer’); Hope this helps, Mark.

I don’t know a solution for SetSelectionFilter. BUT why not append a bollean field to both tables which stores the information ‘selected’ and then setrange(field,true) if count <> 2 then error(‘some mistake in choosing records’)

thanks for your answer, but I it is not what I meant. The following picture of the form will make if more clear I think. (sorry, the ‘insert an image’ functionality doesn’t seem to work (I get an error : Path not found, /forum/outputFile.asp, line 44) but you can see the image at http://www16.brinkster.com/partizan/selection.htm) When the form opens, the first record of each table boxe is allready been selected, since there is a triangle before each of those records. When I click the ‘invoice’ button, I check for the records which have been selected by the user (using the CurrForm.SETSELECTIONFILTER(rec)-procedure), but even when he didn’t choose any records (the form opens and he clicks immediately on the invoice button), the SETSELECTIONFILTER-procedure will return those 2 records. (and the user did actively select any records). I made a workaround, by giving them checkboxes to say : “no records to invoice from tablebox x”, but it would be nice if I could make sure that when the form opens, no records are selected.

quote:


Originally posted by iammicky
I don’t know a solution for SetSelectionFilter. BUT why not append a bollean field to both tables which stores the information ‘selected’ and then setrange(field,true) if count <> 2 then error(‘some mistake in choosing records’)


That might be a solution if you know when he selected the record. Is there a way to know this ?

Yep, an dirty trick : use radio buttons as tableitem ! these buttons can visualize false/true and have an OnPush-trigger which can do all you want to do by setting this field to true without the trouble that appears if you use OnActivate

Maybe this can be of some assistance. Add a button to any listform and apply the following code: OnPush() MyRec.COPY(Rec); CountAll := COUNT; CurrForm.SETSELECTIONFILTER(Rec); Count1 := COUNT; MARKEDONLY(TRUE); Count2 := COUNT; IF Count2 > 0 THEN MESSAGE('%1 have been selected.', Count2) ELSE IF CountAll = Count1 THEN MESSAGE('All %1 have been selected.', CountAll) ELSE MESSAGE('None have been selected.'); Rec.COPY(MyRec); I’m sure you’ll get the picture [;)]

quote:


Originally posted by Steffen Voel
Maybe this can be of some assistance. Add a button to any listform and apply the following code: OnPush() MyRec.COPY(Rec); CountAll := COUNT; CurrForm.SETSELECTIONFILTER(Rec); Count1 := COUNT; MARKEDONLY(TRUE); Count2 := COUNT; IF Count2 > 0 THEN MESSAGE('%1 have been selected.', Count2) ELSE IF CountAll = Count1 THEN MESSAGE('All %1 have been selected.', CountAll) ELSE MESSAGE('None have been selected.'); Rec.COPY(MyRec); I’m sure you’ll get the picture [;)]


yep, great picture [^]. Thanks Steffen. (Also thanks to everyone with their contributions ofcourse

quote:


(by iammicky) Yep, an dirty trick : use radio buttons as tableitem ! these buttons can visualize false/true and have an OnPush-trigger which can do all you want to do by setting this field to true without the trouble that appears if you use OnActivate


I didn’t try this out yet, but I’m sure it works)