Workflow - retrieve value from search table
I am trying to create a workflow (WF) that will allow users to select and zoom to polygon features . Polygon features contain only ServNo field. Users will be searching based on ServNo,APN,AccountNo,Address ( these are stored in SERVICEMASTER table). I have designed the workflow but I still have errors on the section where I try to retrieve the ServNo from the translation table. I noticed the output expected by GetAtrtibuteValue is IList (of String) while my variable is STRING.... Before moving to test phase I have to resolve the error. Any suggestions are greatly appreciated.
Below are the error screenshot, partial WF designer screenshot .
/customer/servlet/servlet.FileDownload?file=00P6000000em1FuEAI
/customer/servlet/servlet.FileDownload?file=00P6000000em1AWEAY
Here is the XAML file: http://data.latitudegeo.com/community/userfiles/5155/servicenosearch_v1_nosrvr.xaml
Thanks in advance!
-
Hi Edmond,
Thanks for taking the time to respond!
Using an IList variable type makes perfect sense! I tried implementing your solution but ran into a problem: can't define a List variable to match yours and as a result, "First()" property is not an option ( see error pic SystemCollectionGenericIlist_selectionError.jpg ). I am still stuck at the GetAttributeValues task.
Attached is your sample model along with mine ( updated with the new IList variable.)
/customer/servlet/servlet.FileDownload?file=00P6000000elzZlEAI
Here are my options for the IList I can use:
/customer/servlet/servlet.FileDownload?file=00P6000000elu2PEAQ
My updated workflow file: http://data.latitudegeo.com/community/userfiles/5155/servicenosearch_v1_nosrvr.xaml
Your sample workflow file: http://data.latitudegeo.com/community/userfiles/5155/retrieveitemfrom_ilist_sample_de.xaml
Thanks!
0 -
Have you added a reference to the System.Linq namespace? (Imports menu)
0 -
Hi Nico,
Thanks for the suggestion of checking that System.Linq namespace was imported - it was also my first thought. I checked Liviu's workflow and it is imported.
regards,
0 -
Hi Liviu,
I see from the images that you've got the intellisense turned on. If you turn it off(Ctrl-Shift-I), you'll be able to create new variables on argument textboxes. With the GetAtributeValues activity, the Values argument will be created of the correct type - System.Collections.Generic.IList<System.String>. In your updated workflow you have it as an array of IList, which is a little bit different.
An alternate method is from the Browse and Select a .Net Type dialog. You'll need to select a type for T like so:
/customer/servlet/servlet.FileDownload?file=00P6000000elzuoEAA
The .first is a extended function that comes from the System.Linq library. It will show up in intellisense when you've selected the correct data type.
regards,
0 -
Edmond,
Your suggestions resolved the issues. There are no more errors in the workflow at this time. Now, the switch branch that handles searches against GIS features works as expected. However, the table search doesn't want to work.. I get an (http://data.latitudegeo.com/community/userfiles/5155/error1.jpg) error in workflow designer ( this screenshot was taken before creting the TableSearch workflow) . When running a search on the table, ( on the actual site) after a few good minutes, I get an (http://data.latitudegeo.com/community/userfiles/5155/error2.jpg) error about missing arguments ... Right away, I start getting error on the GE Manager and I have to reset IIS in order to resolve the issue.
To make this easier to trobuleshoot, I took the sample workflow you provided (named it TableSearch.axml) and configured it to search on one of the fields ( one branch in the flow switch) : APN. I have one parameter added to the SEARCH TABLE : APN , with no default value, only because I...don't know how to set a default value ( 'string' maybe? ) and also not being sure if I do need one. I tried using the table REST endpoint to search and test the results and I noticed that all searches return the same thing ( no matter what APN value I use): all records are being returned- actually the 2000 I specified under Site -->search table. The test workflow ( also attached) returns the same results: first and last of the 2000 records returned by the search.
Here are my questions:
1.Is there an Esri resource that makes a table available, instead of a feature class? Using such link will allow anyone looking for answers on similar issues, to verify/learn how to configure these searches.
2. If my table has over 40000 records, is it OK to leave the deafult 2000 number of records to be returned, or do I need to increase it based on table size ( in GE Manger --> sites --> mysite --> search tables)?
3.Why isn't the search ( even when using the REST endpoint) returning the expected results? Is it because of the parameter? The table is searched but not for the value I am looking for....
4.What argument is it expected ( based on error details)?
Attached is the new (http://data.latitudegeo.com/community/userfiles/5155/tablesearch_nosrvr_04-09-14.xaml) workflow (TableSearch) along with screenshots for parameter and errors :
workflow parameter screenshot:
/customer/servlet/servlet.FileDownload?file=00P6000000em1AHEAY
errors:
/customer/servlet/servlet.FileDownload?file=00P6000000elzcWEAQ
/customer/servlet/servlet.FileDownload?file=00P6000000em1BxEAI
Thank you!
Liviu
0 -
Hi Edmond,
Thank you very much for taking the time to respond! I understand you are busy and your help is greatly appreciated!
I have updated my workflow and while it is runnig without errors, the results are certainly not as expected. Instead of returning 1 record, I get 50 (which is is the max number of records, configured under Site-->Search Tables --> MyTable). In other words, the search returns all records ...it is not denendent on my value ( the Alert I added does confirm the value I entered so......)
Here is a screenshot of the SearchTableParameterQuery showing the settings, including the URL
/customer/servlet/servlet.FileDownload?file=00P6000000elzG5EAI
I have to mention that I do have 1 parameter "APN" (with a set Default Value) added under the SearchTables.ServiceMaster - the table the workflow is searching on .
Thank you!
Liviu
0 -
Hi Liviu,
If you look at the SearchTableParameterQuery, the APN parameter is set to a hard coded value of "945260009". If you go to the Searchtable REST endpoint in a web browser and enter that value, how many results are returned?
If you change the APN parameter to "capturedAPN.tostring" (which is what I believe you want it to be) and re-run the workflow, recording the actual value you entered how many results are returned, and does this match the number of rows in the 3rd party database's table?
If you are still maxing out at 50 records when the APN should only have one, then the issue might be the SQL used in the search table. If it's set to do any type of wildcard matching then you may get more records returned that you expect. For example this select statement will return as many records as possible:
SELECT APN FROM PROJECTS WHERE APN LIKE '%'
Where this statement should return no records (if APN is a not NULL column)
SELECT APN FROM PROJECTS WHERE APN = ''
If you are still having trouble, consider creating a support case and we can work on your system directly via a screen share.
regards,
0 -
Edmond,
I have corrected the SearchTableParameterQuery: set APN = "capturedAPN.tostring".
I used SQL MGMT Studio to check the number of records returned when searching by an APN ( SELECT * FROM tableServiceMaster where APN = '916330018' ) and only 1 record is being returned.
Afterwards, I used the same APN value to test my workflow. I think the problem is caused by the way the SearchTable is configured in Geocortex Essentials Manager ( GEM).
Details: My table COMMAND is set to: SELECT * FROM tableServiceMaster and I added 1 parameter: name APN, defaultValue = '', Max records = 50
/customer/servlet/servlet.FileDownload?file=00P6000000em1ddEAA
If I use the REST endpoint to search on any APN ( including the one verified in SQLMGMTST) I get 50 records returned... actually , even if I leave the parameter value blank and search I still get 50 records... ( max number of records).
Setting COMMAND to SELECT * FROM tableServiceMaster WHERE APN='' would cause REST endpoint search on any value to return no records ( I would think this is expected).
That's why I think I must have the search table configured wrong. What do you think?
Thank you!
Liviu
0 -
Hi Liviu,
You're very close to having it work as you expect. What's missing is the parameter needs to be used in the command. it should look like:
To explain the results you are currently seeing on the REST endpoint (and to help make the behavior clear), open SQL management studio and issue the following:
If you then enter
Hopefully this explanation makes things clear for you.
I'd like to suggest two things to help you:
1) Rename the parameter to APN_to_Find and edit the command to read:
2) Set a default value of APN_to_Find to 916330018.
If you need further clarifications I'd be glad to help.
regards,
0 -
Edmond,
I've started implementing the changes you suggested. Correcting settings for the search table parameter did help: single records were returned. Once the single branch workflow worked as expected, I moved to updating the workflow containing the flow switch.
Workflow description - This workflow should allow users to search a table for either Service Number , APN, ACCOUNTNO, ADDRESS ( combination of 2 fields). If user doesn't have a Service Number, the search using an APN or AccountNo, or Address will be done against the SearchTable and will return a Service Number . The Service Number will then be used to search for features ( polygons) in 2 feature classes. Once polygons found ( mulitple polygons are associated with one Serv NO) the map will zoom to the extent of selection.
Here is the form used:
/customer/servlet/servlet.FileDownload?file=00P6000000elzVpEAI
Once I updated the main workflow ( containing the flow switch) , I came across the same issue: iList definition! I've tried many times to define the iList variable to match the one in the simplified workflow (with 1 branch only) but such type is not available. See comparison below:
(/customer/servlet/servlet.FileDownload?file=00P6000000em22TEAQ) /customer/servlet/servlet.FileDownload?file=00P6000000em22TEAQ
Here is what happens when running the simulator :
step 1 (ok)
(/customer/servlet/servlet.FileDownload?file=00P6000000elu0nEAA) /customer/servlet/servlet.FileDownload?file=00P6000000elu0nEAA
step 2 ( error):
(/customer/servlet/servlet.FileDownload?file=00P6000000elzRXEAY) /customer/servlet/servlet.FileDownload?file=00P6000000elzRXEAY
Note: clicking on image should open the large/original file (if needed).
Besides the issue above, I have one more question regrading setting the search parameters.
Here is how a single parameter is configured for the Search Table:
/customer/servlet/servlet.FileDownload?file=00P6000000eluJpEAI
However, as I explained above, the form will allow users to select one parameter at a time, but have more than one parameter/options to search on ...Therefore, I would see the need to add AccountNo_to_Find, AddressNo_to_Find and StreetName_to_Find parameters. AccountNo_to_Find will work just like APN_to_Find, but StreetNo_to_Find and StreetName_to_Find need to be searched at the same time... Ideally partial searches will work as well ( allowing uses to search for a StreetName only , and get all ServiceNumbers along that street).How do I configure such search ? I tried building a SQL statement using all parameters but .... it didn't work... and, to be honest, I didn' texpect it to work :-).... Can I add the same table multiple times so that I can have one parameter or parameter combination ( for Street Address searches) per search table?
Thank you again for taking the time to reply!
Liviu
0 -
Hi Liviu,
Could I get you to repost the image where you compare the datatypes? The image in the thread is too small to see which datatypes you've selected. I've tried zooming and it just gets pixilated. If you can't create the same type of variable, the workflow isn't going to work.
While you could create one search table with all the SQL parameters in it, the execution may be slow, and the logic a little complex. I'd suggest creating a separate search table for each method of searching. Start with the simple one parameter ones, then build your multiple parameter ones. Test with the REST endpoints as you build each one. Once you've got the multi-parameter one going, then look at adding wildcards for partial matches. The way you've designed your form works well for what you want to do - use a switch statement after the displayform to branch to each search type.
regards,
0 -
Edmond,
Here is the picture comparing the data types .
Note: When posting the picture, I noticed it wasn't quite readable that's why I included additional hyperlinks to the actual picture...but all of them ended up looking the same.) I figured out why: by default all pics are resized when uploading to server ( I had to uncheck the checkbox for "Reduce image size to ..." )
/customer/servlet/servlet.FileDownload?file=00P6000000eluCKEAY
Why wouldn't I be able to create the same type of variable in multiple workflows, when using the same computer? i am still to understand this.
Thanks!
Liviu
0 -
Hi Liviu,
To change a variable's type, you may have to browse to select the correct type. In the property inspector, there is a dropdown for type. Select it and you'll see a list of common and recently used types. If the variable type you want isn't in the list (and there are thousands of combinations, so the list won't show everything) select "Browse for Types" at the bottom of the list. This action will open the Browse and Select a .Net type dialog. Enter the Type Name - systems.collections.generic.ilist and then select the correct item in the dropdown list (between the < >) that you need.
regards,
0 -
Edmond,
That's exactly what I did when trying to change variable type to match the one from the model we initially worked on. It might be possible that the workflow that's working was created by you and edited by me.... Will it be possible for you to check if you can define a variable to match type of iList variable shown in my previous post ( ....IList<System.Object>)? This type is not avaialble in my list of variable types.
Thanks,
Liviu
0 -
Hi Liviu,
Perhaps the issue is that you are looking for System.Object in creating ....IList<System.Object>? If so, just select Object and it will be changed to read System.Object. String is also really System.String.
regards,
0 -
Hi Liviu, 0 -
Hi Majdoleen, 0 -
Thanks Jordan. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
18 Kommentare