Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #1 
I'm looking to use a grid for searching which is working great.  But when i select the row, i want it to populate a text field on the form.  Is there an easy way of doing this using the "When user selects row"?

Currently i'm taking the values found in the grid and setting them equal to txtChosen.  But it's only taking the row from the top of the grid.  How do i get the one i've actually selected?


Edit: Further information, i have searched the forums and came across one that mentioned ProcessContext.UserInput[n].  I am unable to choose this with the Assign Value(s) Activity

Edit #2: I found Fields.grdName.SelectedRow.ToString() and tried a few variations of that and i am still unable to get it working.  I have a feeling i might be doing something wrong with it.  I tried it using assign Values as well as c# script.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #2 
How are you setting the value now, exactly?

Look at the Designer Log admin form in our Admin Tools solution for an example:
http://processmapping.com.au/freestuff/freemetastormbpm9solutions/index.html

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #3 
Currently my text box is set to
Calculated: formProcess.txtChosen

The "When user selects row" is set to Assign Value(s)
formProcess.txtChosen = Fields.grdName.SelectedRow.ToString() <-this throws errors.
formProcess.txtChosen = column1 + ' ' + column2 + ' ' + column3 <-this one works but it only grabs the very first value of the grid

Also, the grid is populated using a business object query
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #4 
Use the supported way: ProcessContext/UserInput[<col>]

Note that col is the BO col, not the grid col.


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #5 
Just tried that now and it's throwing an error...
Variable      Value  
txtChosen   ProcessContext.UserInput[boCMS.CLIENT]

Error
cannot convert from text to 'int'
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #6 
you probably need to cast it
__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #7 
Trying to cast inside
ProcessContext.UserInput[Convert.ToInt16(boCMS.CLIENT)]

It's accepting it but not outputting anything
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #8 
Within the square brackets you need to put the BO column index, zero based.
__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #9 
So using ProcessContext.UserInput[0] works but only grabs just the one column.  I'm trying to get the entire row but it won't let me use more than one ProcessContext.UserInput

Example:
ProcessContext.UserInput[3] + ' ' + ProcessContext.UserInput[2]
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #10 
Problem Solved...

this.Current.Fields.GridName.SelectedRow["col"].ToString() + ' ' + etc...
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #11 
Use the standard supported methods. Any other way is unsupported and will break.

I've been doing this for 15 years, and it always does break.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
JoeOmerta

Veteran
Registered:
Posts: 210
Reply with quote  #12 
which one is the standard supported method?
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #13 
The one I suggested, which is ProcessContext.UserInput. This is documented on page 137 of the manual and in the help file. The help file is more up to date and describes how to get multiple values.


I have no problems at all using this multiple times in the same code.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
royster

Senior Member
Registered:
Posts: 74
Reply with quote  #14 
Hi Jerome
Not sure if this is documented or whether this is me, but I seem to have discovered that if my business object has 30 column and I want to select the 30th column's value, the UserInput[30] always returns nothing

In fact when I do a for (i =0; i < ProcessContext.UserInput.Count; i++) it only returns 0 to 16 of the 30 columns... strange.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #15 
I tried a "select 1,2,...,40" BO, and it worked perfectly
__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!