How to Return Multiple Records(ROWS) from a Search and Select Form

srinivas_deme

Member
Hi All,

Can any body provide me the way to return Multiple records(rows) not fields from a search and select from.
My requirement is I have given Multiple Select Option on the Grid part of the Search and Select Form and If the User Selects 3 records in that form and Press Select Button, These 3 Records should be returned to calling form. My calling form is Header Detail and calling this search and Select from Grid Column, If the User Selects Multiple Rows in Search and Select all the rows should be populated in different grid rows. We are Using JDE 5.0 (ERP8).

Thanks and Regards
Srinivas Deme
 
Hi Srinivas,

I can not imagine other solution (inside E1 Tools) than using a custom cache or worktable, because the number of selected record can no be pre determined.

Maybe you can push the indexes of the selected records into a text or excel file and get it and read them on the calling form - but work file method is easier.

I suppose, you know, how can you solve this task using work table.

Regards,

Zoltán
 
As an alternative, you could create a temporary workfile and populate it with a unique key to identify the user/workstation/job and with the keys to the selected records.

Once the called search & Select would return, the calling application could use the job unique key (passed through Form Interconnect) to read the records sequentially (with select / Fetch Next) and possibly populate the grid.

This is a really easy solution if custom cache manipulation in 'C' is not an option for you or your team.

There are numerous examples in custom objects which you can look at for an inspiration.
 
Hi Sebastien Leclerc and Zoltan.
I am trying to resolve this issue by using a workfile.
Thank you for the information provided by you.
Could you Please name any custom objects for reference in which this kind of functionality exists.

Thanks and Regards
Srinivas Deme
 
OK, well I just had to throw my two cents in to the fray. I just finished with a customization of the Sales Order Entry application where the user could exit to this list of items and prices. The user could select up to 10 items (with units and quantity) and return to the sales order entry screen where the records would be entered into the Sales Order grid. I didn't use cache or workfiles, instead I used an extended data structure for the form interconnect. If the records were selected in the 2nd screen I populated them into the form data structure and passed them back to the calling form. On the calling form's exit I then processed the data structure values upon return (yes, I had to create enough variables to save each of the data structure values). This seemed alot more straight forward than worrying about workfiles that might not get properly erased, or worrying about the application running in two places at the same time (and having to keep the workfile values straight).

Just thought I would suggest an option that wasn't too tough for me.
Ben again,
 
Hi Ben,

Your solution is also a possible one.
I don't want oppose you, just to attach some remark

Your solution also requires extra consideration and coding:
a.) simulating the "indexing" on the extra data structure members - you can not do it in a loop and have to touch each in ER - not too hard, but a bit complex to code it, that repeat only code parts what's really necessary
b.) It have to deal, when less than 10 record selected (OK, when on of the ID is balank or null)
c.) managing the scenario, when more than 10 record selected (issue an error and do not allow to leave the selection form)

On the other side, not a hard task to solve the problem with woork file. You can use a Next Number to separate each possible concurrent sessions and at last you can delete work file records after they had processed with a single partial key update statemenet.

Regards,

Zoltán
 
I too am working on a similar issue with the Bill of Materials app. Originally I thought setting a max # of items to return was a good idea, but now I am leaning towards the WF option because I think it will be more straight forward to code. Also I hate to place limitations on the end-user and the application.

My question is, what event would work best to read the WF and write new grid records?

Options are:
1. Item # Col - Visual Assist Button Clicked
2. Item # - Column Exited & Changed
3. After the Grid Event: Row Exit & Changed
4. ???

My thought is to place the WF code in "Item # - Col Exited" as there is currently code in this event to retrieve more information for the single item returned.

I would either:
-- Use the single item returned in the DS and process using existing logic. Then place the new WF loop at the end of this event and mimic the above logic for all ADDITIONAL items in the WF.
-or- Comment out existing code and work solely off the WF, ignoring the item returned in the DS.

Thoughts on which event to use and/or logic of reading WF/new grid lines? Also does anyone know of vanilla forms out there which have a similar multi-select/add additional rows to grid functionality I could use for review?

Thanks!
Erica
 
Hi Erica,

I am not really familiar wit Bill of Material application, but I think, the solution can be discussed generally.

How do you call currently the Search & Select? From the Item # Visual Assist Button Clicked event?

Here is a scetch, how do I do this task:

1.) I extend the Form Interconnect DSTR of the Search & Select form:
- cCompleted - output - 0 by default, 1 when user returned with Select button
- nCountOfRecordSelected - output - number of selected records (an in WF)
- mnBatcNumber - output - Session Next Number, identifying the current selection records in WF

2.) The index/indicies of the WF begins with the Next Number

3.) On the Search & Select form, in the button clicked event (when at least record selected):
- get a new Next Number (NN) for the session
- issue a partial key WF delete with NN (to be on the safe side)
- going through the grid and insert WF records
- pass back NN and record count and CCompleted=1 in the data structure.

4.) At the place, where I call the Search & Select form, immediatelly after this call:
- if cCompleted <> 1 or record count = 0, then stop further processing
- here maybe I display a Message Form, to congfirm "Would you like to insert all selected row into the grid? (Y/N)", and if answer is NO, then stop further processing, except final partial key WF delete with NN
- Select on WF with NN
- loop through WF reading the WF records and inserting grid lines in a FetchNext/While loop
- finally issue a partial key WF delete with NN

I create a hidden pushbutton and place all logic 4# into its ButtonClicked event. If I do so, then I can call this logic from one or more place easily (e.g. from Visual Assist Button Clicked and/or from a Menu/Toolbar exit), without code repeating, simply issuing a PressButton system function call for this button.

I hope, this help a bit.
Please, let us know your final choice and solution sketch. Thanks.

Regards,

Zoltán
 
Thanks Zoltán for your quick response.

The Search/Select form is called from a the Item# visual assist. The only issue I forsee is placement of the logic after retrurning from the search form. I think placing it directly after the call to the form will work but I am going to have to rearrange quite a bit of existing code. Also I need to take into account times when the user types in the item # vs using the visual assist.

I will let you know what I end up doing and post to the discussion!

Cheers,
Erica
 
How would you populate the grid with the records from the workfile?

As an alternative, you could create a temporary workfile and populate it with a unique key to identify the user/workstation/job and with the keys to the selected records.

Once the called search & Select would return, the calling application could use the job unique key (passed through Form Interconnect) to read the records sequentially (with select / Fetch Next) and possibly populate the grid.

This is a really easy solution if custom cache manipulation in 'C' is not an option for you or your team.

There are numerous examples in custom objects which you can look at for an inspiration.
 
Back
Top