How can we hide a particular column in table dynamically based on the value of check box in IBM BPM coach? - business-process-management

In Coach how to hide the column in a brazos tabel control based on check box value check.
when ever check box click in that time i need to show particular column in a tabel, other wise it should be hide.
we are using IBM BPM 8.5.0
Brazos Toolkit

If you click on the Brazos UI Table component -> Configuration -> Hidden columns -> here you can specify a variable. The value for the variable should be integer. So, depending on the value of your checkbox bound variable (true or false) you may control which column would be hidden by assigning corresponding value to the Integer variable that you use in Hidden Column configuration in a Data Table.
Also, keep in mind that the number of the first column is 0.
If you need to specify multiple hidden columns use comma 0,2 for example.
Hope this helps.

Assuming that your checkbox is not a column on your table, I would recommend you wrap your table in a custom coach view, bind a local variable for hidden columns to your table and pass have another config variable variable for the checkbox value. In the load event handler, initialize the values of the comma separated hidden columns variable (this.context.options.<checkBoxVar>.set("value",[value]) based on checkbox value. Within the change event handler, write an event handler (if(event.property == [checkBoxVar])) for the checkbox change and change the value of the hidden columns appropriately.

Related

ChangingTMS DBAdvgrid cell value at runtime

I have field data named "WAIT" it between 0 and 1 , I want to display it by text value not by its real numeric value , e.g 'Wait','No wait' .
The usual methods of dealing with this problem are:
a) use the Wait field's OnGetText event to return the 'Wait', 'No wait' text depending on the field's value and
b) add a fkCalculated or fkInternalCalc field of ftString type called e.g. WaitText and set its value in the dataset's OnCalcFields event, based on tthe value of your Wait field.
Either of these takes only a minute or two to do.
Using option a) requires you to set up, if you do not already have them, so-called "persistent fields" on the dataset containing the Wait field, which you do via the Fields Editor accessible from the pop-up menu by right-clicking the dataset component in the IDE.

How to set focus on a particular row in a TDBgrid Delphi

I want to set the focus on a specific row on a Tdbgridview.
First, I choose the criteria field ( column concerned by search ex: FisrtName) from a combo box then I type criteria in a TeditField (ex : Jack ).
Then the arrow of the Dbgrifd should point on the concerned row.
How should I do?
thanks.
The TDBGrid component (and all other TDBxxx components as well) are what Delphi defines as dataware components. This kind of component exists as a visual expression of a dataset.
So, in a TDBGrid you should not think about focusing a row of the grid, rather think about positioning a row of the grid's dataset (using the Locate method suggested by TLama, for instance). The grid will notice that the current row of its dataset has changed (because the grid is aware about the condition of the dataset) and will focus the corresponding row.
Update 1
Below you can see an example of what I said:
MyDataset.Locate('Id', 123, []);
The code above simply looks for a certain record in a dataset named MyDataset. The first parameter is the name of a existing field in the dataset. So, you have a dataset with some fields and one of those is named Id. The second parameter is the value contained in that field in the desired row and the third parameter is some options that do not apply here. Go to the Delphi docwiki for more details on the Locate method.
In other words, we are looking for a row in which the field Id has the value 123! If the dataset can find such a row, it will become the current record (or row). If there is a TDBGrid connected to a TDataSource that is connected to TMyDataset, it will automatically update to select the corresponding row, just like you wanted.

Combobox inside data-aware cxgrid

I have a data-aware cxgrid connected to a toracledataset object.
Inside the DB is a column defined as number(1,0) to allow boolean values.
I want to format the corresponding grid column as ComboBox to give the user the ability to choose between the two options.
How can I cast the string inside the combobox to the integer value that will be inserted in the DB?
I know how to do that with a regular combobox, but not inside a cxgrid
The best way will be to use a cxEditrepositiory
add a cxImageComboBox
add Items and define Value and Valuetype
this then can be choosen for your GridColum.RepositoryItem

Delphi grid with a different data type in each row, displayed dynamically

I am trying to create a Delphi grid to allow display and edit in a db grid of data that might have a different data type on each row. I would like to display a specific control for each data type, e.g. when the data type is DateTime, I want to display my custom edit control that allows typing a date in or popping up a calendar.
The data looks something like this:
Name DataType DateValue StringValue BooleanValue
---------------------------------------------------------
A Date 1/1/2007
B String asdf
C Boolean True
...and in the db, this table has a column for each possible type of value. So, there is a BooleanValue column, DateValue, etc.
What I would like to do is display a single 'Value' column in the grid that displays the appropriate edit control depending on what the 'DataType' is for that row. So, the grid should look like :
Name DataType Value
---------------------------
A Date 1/1/2007
B String asdf
C Boolean True
It seems I will need to display a different edit control (to allow the user to edit the Value column) for each row dynamically based on the value of the DataType column. I know there are more advanced grids out there that handle this sort of problem, but the powers that be will not allow anything but what is available out-of-the-box with Delphi.
Any ideas on how to make something like this work?
Personally, I would not go for editing directly inside the TDBGrid in this case, since your Table is not DB normalized (I don't use it in any case actually). I would have used a Calculated field to display the desired value in the grid, And dynamically created the TDBxxxEdits on the form for each field type (How about your own TDBTreeEdit for example, a TDBRichEdit, or a DB Image pickup editor, etc...?).
In case you do want to use your own controls on the TDBGrid, and replace the default TInplaceEdit editor, you can refer the following article: Adding components to a DBGrid, and a related article: Displaying and editing MEMO fiels in Delphi's TDBGrid
Displaying all of the data in the same column is quite easy. You can simply add a calculated string field, and change the value according to what you are storing in that row.
The editing is quite a bit more complicated. If you want to have an in-place editor, you are in for a world of hurt... I've done it, it's a pain, and takes a lot of time. If you want to display a dialog to edit the value, that's much easier. You can add a column objects to the grid and you can setup the column you have attached to the calc field to display a button. When the button is clicked you simply display the editing dialog needed for that row, and commit the edits when the dialog is closed.
There are other ways to get this done, but I would say the above would be the shortest way. Other ways may include custom draw events to display your data in one column, intercept clicks to create your own editor, etc, etc, etc...
after add calculated fields .
Sample:
procedure OnCalculate(DataSet:TDataSet);
begin
case IndexText(DataSet['ValueType'],['Date','String','Boolean']) of
0:DataSet['DateValue']:=StrToDateTime(DataSet['Value']); // also converting
1:DataSet['StringValue']:=DataSet['Value'];
2:DataSet['BooleanValue']:= MatchText(DataSet['Value'],['1','True','T','Y','Yes']);
{etc datatypes}
end;
end;

How to set the default value of a TRxDBLookupCombo control?

Hi all
As the title say. What I want is to make a value as the default value when click a Add button
in the form, the value will be used as a propertity of a document which will be added.
(Yes, this is used in a document management app, one field in the doc will be determined by user via choosing a value in combo, I wanna give user their most possible choice. But now,the default value of combo is empty.)
Just assign the value you want to the field in the dataset which the lookup combobox is attached. The combobox then seek this value in the lookup dataset (the key value) ant show the field value (list value)

Resources