Skip to main content

using the multiselect option in the forms listbox

Comments

11 comments

  • Permanently deleted user

    Jeff,

    First of all, I would like to recommend to use 'Extended' selection mode, rather than 'Muliple' (read more http://msdn.microsoft.com/en-us/library/system.windows.controls.selectionmode(v=vs.110).aspx) on the ListBox. 

    That is the similar as the multiple selection mode, but has more.

    To get to your question, the OutArguments of the multiple (and Extended) Listbox returns as Object (for example, the variable to take the out argument is called 'selectedItemsObj' which is the Object Variabel type.

    Now you have several options to handle it (below are two examples)

    (1) Convert to CType(selectedItemsObj, List(Of Object)).Select(Function(i) i.ToString()).ToArray() and asssign to the variable called 'arraySelectedItems' whose variable type is 'String[]', and carry on with it

     (2) convert to the IList<Object> (whose variable name is 'listItemsSelected' for example using the Cast Assign activity under 'Common Server' from 'selectedItemsObj', and loop through using 'For-Each on 'listItemsSelected', and continue to do with it. You may expand your area with Linq for this.

    Wish this help out,

    Munhwan

     

    0
  • Permanently deleted user

    Hi Laura

    How about adding a step before the form where the user can select from the dropdown box to ask the user 'Do you want a generate for all consents on this date' with a Yes / No choice.

    If Yes then you can bypass the present form.

    Regards

    Ralph

    0
  • Permanently deleted user

    Hi Ralph,

    I'm not sure what you mean? They will have to use the form to Select the Date, otherwise by-passing the form wont do anything. Do you mean creating a seperate form that just has the Date Drop down and it auto-selects all Case Numbers associated with this date?

    Thank You,

    Laura

    0
  • Permanently deleted user

    Thank You Ralph, that's perfect.

    Now my only problem is when it gets to the Cast, I get the error "Unhandled exception: 'Unable to case object of type 'ESRI.ArcGIS.Client.Tasks.FeatureSet' to type 'System.Collections.Generic.IList' 1[System.Object]'.' in activity '1:87:Cast<IList<Object>>'.

    Any ideas on what i'm going wrong would be really appreciated. 

    Thank You,

    Laura

    0
  • Permanently deleted user

    Hi Laura

    I am supposed to be on leave currently but in the office dealing with a problem. I will endeavour to have a look on Monday if that is OK.

    Have a good New Year

    Regards

    Ralph

    0
  • Permanently deleted user

    Hi Ralph, whenever you can is fine and thank you again. -Laura-

    0
  • Permanently deleted user

    Hi Laura

    can you please post the contents of your report definition ie the rpx file?

    Does anything show up in the Geocortex logs when you run the workflow. You will need to run from your viewer rather than the Simulator as well since you are using the Report activity rather the Run Template Report Activity (activity name from memory only) where you refer to a specific rpx file amongst other requirements. The Simiulator does not know what these things are:

     LayerId="6" MapServiceId="2" ReportId="0"

    Thanks

    Ralph

    0
  • Permanently deleted user

    Hi Ralph,

    In the log it said the following after I ran the Workflow in the viewer: "<Event Timestamp="2014-01-03T16:50:23.5929116-06:00" Level="ERROR" Identity="Guest"><Message>Exception has been thrown by the target of an invocation.

     

    Error performing the query: [Invalid or missing input parameters.].

     

    Invalid or missing input parameters.</Message></Event>"

    Below is my rpx file:

    <?xml version="1.0" encoding="UTF-8"?>

     

    <ActiveReportsLayout Version="3.1" PrintWidth="12240" DocumentName="ARNet Document" ScriptLang="C#" MasterReport="0">

     

      <StyleSheet>

     

        <Style Name="Normal" Value="font-family: Arial; font-style: normal; text-decoration: none; font-weight: normal; font-size: 10pt; color: Black; ddo-char-set: 204; " />

     

        <Style Name="Heading1" Value="font-size: 16pt; font-weight: bold; " />

     

        <Style Name="Heading2" Value="font-family: Times New Roman; font-size: 14pt; font-weight: bold; font-style: italic; " />

     

        <Style Name="Heading3" Value="font-size: 13pt; font-weight: bold; " />

     

      </StyleSheet>

     

      <Sections>

     

        <Section Type="PageHeader" Name="PageHeader1" Height="0" BackColor="16777215" />

     

        <Section Type="Detail" Name="MailingLabelDetail" Height="1440" ColumnCount="3" ColumnDirection="1" ColumnSpacing="180" BackColor="16777215" CanGrow="0">

     

          <Control Type="AR.Field" Name="OwnerName" DataField="OWNER_NAME" Left="0" Top="0" Width="3870" Height="450" Text="OWNER" Multiline="0" CanGrow="0" Style="font-weight: bold; vertical-align: middle; " />

     

          <Control Type="AR.Field" Name="Address" DataField="OWNER_ADDRESS" Left="0" Top="450" Width="3888" Height="259.2" Text="Address" Multiline="0" CanGrow="0" Style="white-space: nowrap; " />

     

          <Control Type="AR.Field" Name="City" DataField="OWNER_CITY_ST" Left="0" Top="720" Width="3870" Height="270" Text="City" Multiline="0" CanGrow="0" Style="white-space: nowrap; " />

     

          <Control Type="AR.Field" Name="ZipCode" DataField="OWNER_ZIP_CODE" Left="0" Top="1036.8" Width="3888" Height="259.2" Text="ZipCode" Multiline="0" CanGrow="0" />

     

        </Section>

     

        <Section Type="PageFooter" Name="PageFooter1" Height="0" BackColor="16777215" />

     

      </Sections>

     

      <ReportComponentTray />

     

      <CalculatedFields>

     

        <Field Name="MailingAddressCalc" Formula="(HOUSENO.ToString().Trim() != &quot;&quot; ? HOUSENO + &quot; &quot; : &quot;&quot;) + (STDIR.ToString().Trim() != &quot;&quot; ? STDIR + &quot; &quot; : &quot;&quot;) + (STNAME.ToString().Trim() != &quot;&quot; ? STNAME + &quot; &quot; : &quot;&quot;) + (STTYPE.ToString().Trim() != &quot;&quot; ? STTYPE : &quot;&quot;)" FieldType="String" />

     

        <Field Name="Name" Formula="OWNERFIRST + &quot; &quot; +  OWNERLASTN" FieldType="String" />

     

        <Field Name="Field1" Formula="&quot;http://www.google.com/&quot; + OWNERFULLN" FieldType="None" />

     

      </CalculatedFields>

     

      <Script><![CDATA[using System.Data;

     

    using System.Collections.Generic;

    public void ActiveReport_DataInitialize()

     

    {

     

     try {

     

     

     

      string sortField = "OWNER_NAME";

     

     

     

      int dtIndex = 0; //Index of the DataTable in the DataSet.

     

      int skipCount = 0;

     

      int numRows = (rpt.DataSource as DataSet).Tables[dtIndex].Rows.Count;

     

      int numColumns = (rpt.DataSource as DataSet).Tables[dtIndex].Columns.Count; 

     

      List<string> ownerNames = new List<string>(); 

     

      bool[] removedRows = new bool[numRows];

     

      

     

      //Sort the default view of a copy of the DataSet

     

      

     

      DataSet sortedData = (rpt.DataSource as DataSet).Copy(); 

     

      sortedData.Tables[dtIndex].DefaultView.Sort = sortField + " ASC";  

     

     

     

      //Check the data for duplicates and track which ones these are so they can be removed.

     

      

     

      for(int i=0; i<numRows; i++)

     

      { 

     

       string owner = sortedData.Tables[dtIndex].DefaultView.ToTable().Rows[i][sortField].ToString();

     

        

     

       if (!ownerNames.Contains(owner))

     

       {

     

        ownerNames.Add(owner);

     

       }

     

       else

     

       {

     

        removedRows[i] = true;  

     

        skipCount++;

     

       }

     

      }

     

     

     

      //Remove rows from the DataTable so that it is the correct size when duplicates are removed.

     

      

     

      for (int i = 0;i<skipCount;i++)

     

      {

     

       (rpt.DataSource as DataSet).Tables[dtIndex].Rows[0].Delete();

     

      }  

     

      (rpt.DataSource as DataSet).Tables[dtIndex].AcceptChanges();

     

      

     

      //Loop through the dataset, replacing the old data with sorted data

     

      //The OBJECTID column is left untouched as we don't really care what it contains at this point.

     

      //Rows marked as duplicates will be skipped, and the results will fit into our resized DataTable.

     

        

     

      skipCount=0;

     

     

     

      for (int i = 0; i < numRows; i++)

     

      { 

     

       if (removedRows[i])

     

       {

     

        skipCount++;

     

        continue;

     

       }  

     

       for(int j=0; j < numColumns; j++)

     

       {

     

        string columnName =  (rpt.DataSource as DataSet).Tables[dtIndex].Columns[j].ColumnName;

     

         

     

        if (columnName != "OBJECTID")

     

        {

     

         (rpt.DataSource as DataSet).Tables[dtIndex].Rows[i-skipCount][j] = sortedData.Tables[dtIndex].DefaultView.ToTable().Rows[i][j];

     

        }  

     

       }

     

      }

     

     

     

     }

     

     catch (Exception ex) {}

     

    }]]></Script>

     

      <PageSettings LeftMargin="261" RightMargin="261" TopMargin="720" BottomMargin="720" GutterMargin="14" Orientation="1" />

     

      <Parameters />

     

    </ActiveReportsLayout>
    0
  • Permanently deleted user

    Hi Laura

    my initial thought (without logging in to work to use the Workflow Designer) is to get the DataTable within the workflow since you can then use the SQL Select Activity where the SQL statement will have the sorting etc that your code is doing in your report.

    Does the report run if you cut (and put somewhere safely) your code?

    Also does the Query Activity just before the Report Activity return any results? Try adding an Alert Activity with selectedFeatures.Features.Count.ToString as the Message parameter to see what has been selected.

    Regards

    Ralph

    0
  • Permanently deleted user

    Hi Stephanie

    Can you please check that this query where statement works:

    "ZC_DATE = ' caseDate '"

    To me you are asking for the records where ZC_DATA is equal to the string ' caseDate'

    If you go to this url http://testmapitwest.fortworthtexas.gov/ags/rest/services/JenninL/AddressVerify/MapServer/9 and figure out what to use in the where statement then I am sure we can get some progress. ;-)

    Regards

    Ralph

     

    0
  • Permanently deleted user

    Hi Laura

    would you like to e-mail me off-forum about this to save so much forum back and forth until we get this resolved?

    ralph.price@rdc.govt.nz and cc togeocortex@ravalproductions.co.nz

    Regards

    Ralph

     

    0

Please sign in to leave a comment.