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)
Related
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.
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.
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.
I want to enable the user to enter a contact name in an data-aware edit control (combobox, edit) with autosuggest items bound to an sql table.
What I want to achieve is this:
a combo bound to Contact_Name field of a datasource,
an edit bound to Contact_Tel of same datasource
an edit bound to Contact_Email of same datasource
The combo dropdown should be bound to a sql datasource and display person name, phone number and email. The user can pick one of the existing options or type an arbitrary name (new contact person).
When the text of the contact person combobox changes, then
- if the text matches one of existing options, two other edit controls are filled with the phone number and email of the option selected, or
- if the text is not in list, the other two edit controls are cleared.
The set up that I currently have is
a dbLookupComboBoxEh bound to a field of a dataset + a listsource with key and listfields + style = csDropDownEh.
The problem is that it works fine when the user types in a value that is contained in the list source, but once I type in something that is not on the list the control simply gets cleared and doesn't remember the value any more.
Is there a control that combines a data-bound drop down with suggested values AND ability to enter ARBITRARY text?
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;