Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Heather@FootAnstey
Posts : 57
Join date : 2018-12-19

Selecting a search item from TaskFlow Empty Selecting a search item from TaskFlow

Fri 17 Apr 2020 - 14:08
Original Post: Dwayne 19/10/2012 02:17:16

"I was wondering if there was any way to display a search list in a window that allows the user to select a specific item in a search list, if the search list contains more
than one item.
I want to be able to do this from code, specifically a TaskFlow action. The selected item will be used by the action to carry out specific tasks based within TaskFlow.
Thanks
Dwayne"

Responses:

Peter Barnett 19/10/2012 02:47:35

"Hi Dwayne Do you want the search list to display in a wizard or in it's own form? Peter"

Dwayne 19/10/2012 03:01:26

"Hi Peter,
I'd like it to appear as a dialog, that the user may select an item and when clicking OK the selected search list item is returned (as a DataRow?).
Regards
Dwayne"

technical [Phil] 19/10/2012 09:28:10

"Hi Dwayne,
Create a Control Library (DLL) and add a windows form to that library. Set the form properties to FormBorderStyle = FixedDialog, MaximumBox = False, MinimumBox
= False, SizeGripStlye = Hide.

You can get the form to show from a task by added a Reference to the Dll to the script then using ShowDialog() Method to create a modal Box i.e.


public class PJW_TEST : FWBS.OMS.FileManagement.ApplicationScriptType {
private void Show_Dialog()
{
Testing.UI.frmSearchListTest form = new Testing.UI.frmSearchListTest();
form.ShowDialog();
//If you want to return stuff i.e. the datarow selected
//then create a public property on the form of type DataRow
//Set this property when the cell is selected
//You can then access it here
}

To get the Searchlist data to display add reference to FWBS.Common.dll, OMS.Data.dll, OMS.UI.dll and OMS.Library.dll. In the Load event of the form insert the following code to get the search list and its data then insert that data into the grid view on the form.

private void frmSearchListTest_Load(object sender, EventArgs e)
{
//My Search list took a parameter of clID
(Name of the Bound Value without the %) which is in fact a Client id

FWBS.Common.KeyValueCollection kvc = new FWBS.Common.KeyValueCollection();
//Leave this next line out if you dont have any parameters on your search list kvc.Add(“clID”, 43);
//udSMSTesting1 is the code of my search list
FWBS.OMS.SearchEngine.SearchList t = new FWBS.OMS.SearchEngine.SearchList(“udSMSTesting1”, null, kvc); t.Search(false);
//Set the results as the datasource for the grid view dataGridView1.DataSource = t.DataTable; dataGridView1.Refresh();
}
Hope that helps Phil"

Richard Annison 19/10/2012 09:46:57

"Hi Dwayne,
You can also look at method FWBS.OMS.UI.Windows.Services.Searches.ShowSearch(...) it returns a key value collection which is the return values from the select row in the search list.
If you want a little more control or want to be able to get multiple selected rows back then you can use the class FWBS.OMS.UI.Search. Regards
Richard"

technical [Phil] 19/10/2012 09:50:02

"I like that one Richard, makes my attempt look a little over engineered! Cheers Phil"

Richard Annison 19/10/2012 10:00:14

"Your approach is valid Phil, it is essentially what we are doing in the UI.Search class in this case. I guess it's all a trade off of how much control you want yourself and how much built in functionality you want to use.
Richard"

Dwayne 21/10/2012 23:20:07

"Hi Richard,
I had tried the FWBS.OMS.UI.Windows.Searches.ShowSearch()method, however I receive the error Search Group 'udXXXXXXXXX' not found...with the following diagnostic info:
-== Diagnostics Information ==- ###
UserName : Dwayne Wilkinson User ID : 3
Date/Time : 22/10/2012 8:42:06 AM Computer Name : xxxxxx
-=OMS=-
Database Version : 5.0.1.8 Engine Version : 5.0.0.25

-=Message=-
Search Group 'udWCDISPUTES' not found...

-=Inner Message=- [Exception]
Exception of type 'System.Exception' was thrown.

-=Stack Trace=-
at FWBS.OMS.UI.Windows.ucSearchControl.SetSearchListType(String type, Object parent, KeyValueCollection parameters, Boolean force) at FWBS.OMS.UI.Windows.ucSearchControl.SetSearchListType(String type, Object parent, KeyValueCollection parameters)
at FWBS.OMS.UI.Windows.frmSearch..ctor(String code, Boolean asType, Object parent, KeyValueCollection param, Boolean autoSelect, TriState multiSelect) at FWBS.OMS.UI.Windows.Services.Searches.ShowSearch(IWin32Window owner, String code, Boolean asType, Size size, Object parent, KeyValueCollection param)
at FWBS.OMS.UI.Windows.Services.Searches.ShowSearch(String type, Object parent, KeyValueCollection param) at OMS.Scriptlets._dwTEST.NETButton8_Click(Object sender, EventArgs e) in
c:\Users\adrw\AppData\Local\FWBS\OMS\0\ADLSSQL08\MCMINTDEV\Cache\Scriptlets\_dwTEST\135._dwTEST.129953309901778863-0.cs:line 189###

I am calling the ShowSearch() method like so:
FWBS.OMS.OMSFile file = FWBS.OMS.OMSFile.GetFile(4); FWBS.OMS.UI.Windows.Services.Searches.ShowSearch(“udWCDISPUTES”, file, new KeyValueCollection()); Regards,
Dwayne"

Dwayne 21/10/2012 23:31:11

"Hi Richard,
However the following code does work:
FWBS.OMS.OMSFile file = FWBS.OMS.OMSFile.GetFile(38854);
FWBS.OMS.SearchEngineSearchList list = new FWBS.OMS.SearchEngine.SearchList(“udWCDISPUTES”, file, new KeyValueCollection());
FWBS.OMS.UI.Search search = new FWBS.OMS.UI.Search(list); KeyValueCollection selectedItem = search.Show();


Thanks for your help.
Regards,
Dwayne"

Richard Annison 22/10/2012 10:31:04

"Hi Dwayne,
I think in this case the code relates to the searchlist group which is a property on the searchlist list. Richard"








Back to top
Permissions in this forum:
You cannot reply to topics in this forum