Multiple Drop List Selection 
Author Message
 Multiple Drop List Selection

I am a new Clarion developer, and have a question about selecting
multiple recordes from a drop down combo list.
I am unsure of the dictionary and application procedure necessary to
implement the MARK queue for multiple selection.  I have looked
through various manuals and online help, but the procedure and steps
involved do not seem to be outlined anywhere.  HELP would be grealty
appreciated!!!

I already have the DropCombo designed and functioning properly on a
form for single record selection, but now I need to allow a user to
make multiple selections and have NO idea how to do so!?



Wed, 20 Oct 2004 03:31:53 GMT  
 Multiple Drop List Selection
Quote:

> I am a new Clarion developer, and have a question about selecting
> multiple recordes from a drop down combo list.
> I am unsure of the dictionary and application procedure necessary to
> implement the MARK queue for multiple selection.  I have looked
> through various manuals and online help, but the procedure and steps
> involved do not seem to be outlined anywhere.  HELP would be grealty
> appreciated!!!

> I already have the DropCombo designed and functioning properly on a
> form for single record selection, but now I need to allow a user to
> make multiple selections and have NO idea how to do so!?

Michele, first thing I use a List Box, not a drop down combo box,
Here are the steps I follow
1 on the General Tab of the properties you should set the value of the
drop to   0 (Zero)
2 on From field you should see something like this "Queue:FileDrop:1"
3 on the Mark field of the Extra Tab write "Queue:FileDrop:1.Mark"
this enables multiple item selection
4 I check "Hide Selection" on the Options Box this simply removes the
selection bar from the list, that normally appears selecting the first
record on any list.

I also have a Queue with 2 o 3 fields like the ones on the list ie
CodeNumber, Name, then I place a button ie for a report a Go Button
and embed the following code

Control Events
   ?Pause
      Accepted

        FREE(QAsis)                                   !Clean up queue
        LOOP LoopIndex=1 TO RECORDS(Queue:FileDrop:1) !Pick up the
ones marked
          GET(Queue:FileDrop:1,LoopIndex)
          IF Queue:FileDrop:1.Mark                    !If Marked
             QAsis.Codigo=Queue:FileDrop:1.Codigo     !Add element to
Queue
             ADD(QAsis)                      
           END
        END

From here on you can do whatever you want now that you have a Queue
with only the elements you wanted

I hope you find this useful,

CU

Diego Sanchez



Wed, 20 Oct 2004 22:33:49 GMT  
 Multiple Drop List Selection
Hi Diego,

I think your explanation might be somewhat along the lines of something I
want to do but have no idea of how to do/code it.

I want to be able to have 4 dropdowns to set a filter for a list box at the
top of an inventory browse.  The dropdowns will be for;  Year, Make, Model,
Unit.

The year, make, model, and unit are to be selected from a "control file" to
allow user defineable selections for each dropdown.

After the "Year, Make, Model, Unit" are "selected" in their respective
dropdowns, I want the inventory list to only show items that are for the
"Year, Make, Model, Unit" in the inventory's browse list.  Many times the
result of the complete filtering by all four filter elements will only be
one item in the list.  Or maybe no items will show at all.

What would really be nice is for the browse list to immediately change to
include only items for the "Year" included in the inventory browse list when
the "Year" has been selected,

and then for the browse list to immediately change to include only items for
the "Year and Make" in the inventory browse list when the "Make" has been
selected,

and then for the browse list to immediately change to include only items for
the "Year, Make and Model" in the inventory browse list when the "Model" has
been selected

and then for the browse list to immediately change to include only items for
the "Year, Make, Model and Unit" in the inventory browse list when the
"Unit" has been selected.

How could this be done???

--
--------(;-)}
Regards,
Earl R Coker

www.kwiksystems.com



Quote:
> > I am a new Clarion developer, and have a question about selecting
> > multiple recordes from a drop down combo list.
> > I am unsure of the dictionary and application procedure necessary to
> > implement the MARK queue for multiple selection.  I have looked
> > through various manuals and online help, but the procedure and steps
> > involved do not seem to be outlined anywhere.  HELP would be grealty
> > appreciated!!!

> > I already have the DropCombo designed and functioning properly on a
> > form for single record selection, but now I need to allow a user to
> > make multiple selections and have NO idea how to do so!?
> Michele, first thing I use a List Box, not a drop down combo box,
> Here are the steps I follow
> 1 on the General Tab of the properties you should set the value of the
> drop to   0 (Zero)
> 2 on From field you should see something like this "Queue:FileDrop:1"
> 3 on the Mark field of the Extra Tab write "Queue:FileDrop:1.Mark"
> this enables multiple item selection
> 4 I check "Hide Selection" on the Options Box this simply removes the
> selection bar from the list, that normally appears selecting the first
> record on any list.

> I also have a Queue with 2 o 3 fields like the ones on the list ie
> CodeNumber, Name, then I place a button ie for a report a Go Button
> and embed the following code

> Control Events
>    ?Pause
>       Accepted

>         FREE(QAsis)                                   !Clean up queue
>         LOOP LoopIndex=1 TO RECORDS(Queue:FileDrop:1) !Pick up the
> ones marked
>           GET(Queue:FileDrop:1,LoopIndex)
>           IF Queue:FileDrop:1.Mark                    !If Marked
>              QAsis.Codigo=Queue:FileDrop:1.Codigo     !Add element to
> Queue
>              ADD(QAsis)
>            END
>         END

> From here on you can do whatever you want now that you have a Queue
> with only the elements you wanted

> I hope you find this useful,

> CU

> Diego Sanchez



Thu, 21 Oct 2004 00:20:24 GMT  
 Multiple Drop List Selection
Hi all,


Quote:
> I want to be able to have 4 dropdowns to set a filter for a list box at
the
> top of an inventory browse.  The dropdowns will be for;  Year, Make,
Model,
> Unit.
<snip>
> and then for the browse list to immediately change to include only items
for
> the "Year, Make, Model and Unit" in the inventory browse list when the
> "Unit" has been selected.

  This can be done in the IDE but I would recommend you do it in a separate
file, that way you will never need to do all the typing again.

  Anyway,  I assume that the four fields are longs or strings.

  Derive the browse class and add two methods.

  Method prototypes will be

  SetFilter(string fld, *string filterValue, string pri, byte autoReset =
true)
  SetFilter(string fld, *long filterValue, string pri, byte autoReset =
true)

  Method bodies will be

  SetFilter(string fld, *string filterValue, string pri, byte autoReset =
true)

  code

  Self.SetFilter(clip(fld) & ' = ' & '<39>' & clip(filterValue) & '<39>',
pri)
  if (autoReset)
    Self.ResetSort(true)
  end
  return

  SetFilter(string fld, *long filterValue, string pri, byte autoReset =
true)

  code

  Self.SetFilter(clip(fld) & ' = '  filterValue, pri)
  if (autoReset)
    Self.ResetSort(true)
  end
  return

 In the accepted embed for the drop downs,

  for the year
  BrwX.SetFilter('Pre:Year', LocalYearVariable, '4')

  for the make
  BrwX.SetFilter('Pre:Make', LocalMakeVariable, '3')

  and so on.

  you can have the browse reset for each field or just for the last field
entered ...

  Also, you cna add a fourth parameter to the prototypes, 'string cond'  and
call the methods like

     BrwX.SetFilter('Pre:Year', LocalYearVariable, ' >= ', '4')
   then in the method body,

  Self.SetFilter(clip(fld) & cond &  filterValue, pri)

  this will give you filters for <>, <= ...

    as I said this  can all be done in the IDE but I would place it in a
separate file and never write a filter statement again.

    Also, if you make use of the who, what, and where functions you can just
pass the methods the fields Pre:FieldName,  and not have to worry about the
'Pre:FieldName'

     Dennis



Thu, 21 Oct 2004 01:23:52 GMT  
 Multiple Drop List Selection
Michele,

Have you tried setting a Record Filter on the List Properties??

Record Filter :  INV:Make=MKE:Make AND IVN:Year=YER:Year AND INV:Model=MOD:Model
AND son on



Thu, 21 Oct 2004 23:40:06 GMT  
 Multiple Drop List Selection
Hi Earl!

What you want to achieve is just what I am doing right now - not for
cars, but pacemaker devices - the essence is the same. This is little
off topic for this discussion thread (not directly connected with
multiple selections from a dropdown list), but here is how it can be
solved:

In your example "Year", "Make", "Model" and "Unit" are the fields from
the (primary) file, the one you want to filter out. The problem is a bit
more intriguing if fields to filter on are not only from the primary
file, but from some secondary files related (joined) to the primary as
well.

Droplists for "Year", "Make"... etc. should contain only the values
already present in these fields, so your user should never get an empty
filtered browse. Moreover, for each such a value there should be just a
single item to select from a droplist. The easiest (at least
theoretically) way to achieve this should be to define a UNIQUE key on
the appropriate field in the Data Dictionary for the appropriate file,
and then to build a FILE or PAGE loaded droplist ordered by that key
(using CONTROL TEMPLATEs from the IDE). More precisely, droplists have
to be built on ALIASES of the file in question, to avoid record
positioning problems (i.e. to enable separate file buffer for each
droplist). So, for each droplist you have to define a unique key and
alias, and then populate a File loaded Droplist template.

But this creates another problem: when a database must allow multiple
record instances with the same value of the field (and it must -
otherwise there's a little need for filtering), when you try to
insert/update a file with such a UNIQUE key you get the "duplicate key"
error. This problem may be resolved by: (1) using DYNAMIC keys for the
droplists (that live just as long as the procedure they are used in);
and (2) using QUEUEs built by your own code. I prefer using queues;
nevertheless, dynamic keys might be easier to implement (and I'll try
them in my next project).

If the procedure with the filtered browse is used only for retrieving
data from the database you'll have to fill these queues just once, at
the beginning of the procedure (ThisWindow.Init embeds in ABC) -
otherwise you have to refresh queues after each update, which is not a
problem either. The most appropriate point to invoke the code for
refreshing queues (if any) depends on your procedure logic. The code for
filling such a queue is short and self explaining. Here the variable
used for filtering is MOD:MODE - a MODULE variable, because it is used
in another (report) procedure within the same module. User chooses it's
value from the MODEQue, built in ThisWindow.Init() and displayed in a
droplist of choices:

!Module Data
MOD:MODE  STRING(15),STATIC !The MODE selected for filtering

!Procedure Local Data
MODEQue   QUEUE,PRE(MQ)!The queue of all possible unique values for MODE
of pacing
QMODE       STRING(15) !The MODE of pacing
          END
SaveState USHORT       !For restoring original position in EquipmentType

!ThisWindow.Init(), after opening the window
DO ReFillMODEQue

!Procedure Routines
ReFillMODEQue ROUTINE
!
! Fills in the the field EQT:MODE from EquipmentType file, unique
!
  FREE(MODEQue)    !Not neccessary if this routine invoked only once
  SaveState = Access:EquipmentType.SaveFile()
  CLEAR(EQT:MODE)
  SET(EQT:ByMODE,EQT:ByMODE) !Sequential file processing ordered by
ByMODE key
  LOOP
    IF Access:EquipmentType.Next() <> LEVEL:Benign THEN BREAK END !No
more equipment type rec's
    CLEAR(MQ:QMODE)
    MQ:QMODE = EQT:MODE
    GET(MODEQue,+MQ:QMODE)
    IF ERRORCODE() THEN ADD(MODEQue,+MQ:QMODE) END
  END
  Access:EquipmentType.RestoreFile(SaveState)
! If the queue is not empty display it's first item in the droplist
?MOD:MODE
  IF RECORDS(MODEQue)
    GET(MODEQue,1)
    MOD:MODE = MQ:QMODE
  END
  DISPLAY(?MOD:MODE)
  EXIT

!ThisWindow.Kill(), priority 7501
!Release memory used for the queue
FREE(MODEQue)

This is just the "mechanics" of making droplists from queue(s) / unique
key oredered file(s). For the rest (the harder part) of the job see a
post from mr Dennis E. Evans in this thread: a shining example of ABC
subclassing - THANK you Dennis!

HTH

Zoran



Fri, 22 Oct 2004 19:24:58 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Multiple Selection / Drag 'n Drop ?

2. Help ... Coding DROP DOWN LISTS / MULTI SELECTIONS ALSO

3. Blank selection in drop-down list

4. Problem: multiple item selection on list

5. Help On List Multiple item Selection Using Mark

6. multiple selection in list boxes

7. Multiple selection list box

8. Multiple Selections from List Box

9. Multiple selection in a list

10. List Box with Multiple Selections

11. Selection in multiple list boxes

12. Multiple selection in TK list

 

 
Powered by phpBB® Forum Software