ChangingTMS DBAdvgrid cell value at runtime - delphi

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.

Related

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

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.

How to load pictures from a list asyncron, to show the text first

I want to load a list with thumbnail pictures from the internet. In order to have a good user experiance, I want to load and display the text of the list first, and want to load the pictures from the list in a background thread. When a picture is downloaded I want to show it in (refresh) the correspondig row of the list.
Actually, I don't know where to start. Can I use a TClientDataset component to load the text first and load the pictures in a background thread and insert it with .Locate() .Edit .Post to the dataset?
You can use a TClientDataSet for requesting the data directly, except the picture. Thus, the fetching of the main data should be fast enough.
You should load the picture as a calculated field then. Documentation says (with my own emphasis):
A calculated field displays values calculated at runtime by a
dataset's OnCalcFields event handler. For example, you might create a
string field that displays concatenated values from other fields.
To create a calculated field in the New Field dialog box
Enter a name for the calculated field in the Name edit box. Do not enter the name of an existing field.
Choose a data type for the field from the Type combo box.
Enter the size of the field in the Size edit box, if appropriate. Size is only relevant for fields of type TStringField, TBytesField, and TVarBytesField.
Select Calculated or InternalCalc in the Field type radio group. InternalCalc is only available if you are working with a client dataset. The significant difference between these types of calculated fields is that the values calculated for an InternalCalc field are stored and retrieved as part of the client dataset's data.
Choose OK. The newly defined calculated field is automatically added to the end of the list of persistent fields in the Field editor list box, and the component declaration is automatically added to the form's or data module's type declaration.
Place code that calculates values for the field in the OnCalcFields event handler for the dataset. For more information about writing code to calculate field values, see Programming a calculated field.
In OnCalcFields event handler you then need to implement asynchron loading of the picture.

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.

How to remove a FIELD of "Text Object" in FastReport that has NULL Value

Here my table:
QUESTION:
How to remove the Field that has NULL Value?
How is the appropriate Algorithm ?
You can suppress the printing of the label by setting its Visible property in the OnBeforePrint event in the report.
However, this will still leave you with a blank line, so you can solve this in one of three ways (in ascending order of difficulty).
Firstly, you can ignore suppression of the label printing detailed above and set the Text property of the field to be 'No' if the DB field is NULL in the OnBeforePrint or OnGetText events.
Alternatively, you can define a memo field and in the OnBeforePrint method calculate its Text property to only include the Non-Null values and their labels.
Finally, you can look at the documentation and use scripting to modify the Report Engine's CurrX and CurrY properties in order to suppress the blank lines.

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