access 2010 listbox OLE field - listbox

I have a simple query showing serial numbers and a machine type for a simple searchable function within a form. this query also contains an OLE column whih contains customer gathered data from a machine (parameters and alarm histories etc). I want the OLE section to be included within the list box so when the machine is searched for, the searcher will have access to all of the data for that machine.
is there an 'on click' or 'on enter' command for this?
Many thanks in advance

You put the recordID, along with the serial number and machine type in the query for the list box. then when the listbox selection is made, the event can trigger filling in the OLE field on the form - by using the recordID of the selected item.
All that being said - it's a huge guess as to even what you're talking about because you haven't shown us any form or table design or query.

Related

Livebindings Expressions for 2 TComboboxes parent to child relationship using ClientDataSets in RAD Studio

I am trying to connect the parent TCombobox to child TCombobox using the Livebindings in RAD Studio. Meaning, when I select a customer in the parent Tcombobox, the child Tcombobox will generate the jobs under the parent only.
I have tried some binding expressions as you can see in the screenshots below but no avail. I also included below my tables screenshots.
What I want to achieve is to limit the list of jobs with customer-related jobs only. The screenshot below highlighted in blue should be the ones in the dropdown only.
Any help would be greatly appreciated.
I want to conclude this question by answering my own question. I wouldn't get the answer if not for some nice people here willing enough to share quick help. Here's what I got:
I used the ClientDataSet Filtering here. First, I initialized the key field of my clientdatasetJob then set the range of filter by the value selected in the combobox.
cdsJob.IndexFieldNames := 'CustomerName';
cdsJob.SetRange([cmbCustomer.Text],[cmbCustomer.Text]);
You might wonder why same values given in the set range. Basically, I don't need the range but a single value only. I added as well the field CustomerName in the clientdatasetJob for my key field.

Delphi - ADODataSet Subset

I am building a form in Delphi that has a dropdown of Services and a grid of Add-Ons for the select service. The data I am getting comes from an API and I am storing the data for the Services in an ADODataSet as follows:
ID (integer)
Name (string)
Description (string)
BasePrice (currency)
AddOns (array of AddOn, not currently stored in the ADODataSet)
I would like to have the grid populate with the AddOn data based on the selection from the dropdown (each Service has a different list of Add-Ons). How do I store the AddOn information so that it can be related back to the Service info? Do I need to create a second ADODataSet or is there a way to store it in the same ADODataSet as the Services?
The AddOns have the following fields:
ID (integer)
Name (string)
Description (string)
UnitPrice (currency)
Quantity (integer)
I am using Delphi 2005 and have Indy for Delphi.
EDIT
In digging around the Fields editor for Datasets I found that I can create a field of type 'DataSet'. Would this allow me to tie the two together? If so can someone explain how that is done?
I tried to do it by creating a second dataset (ADODataSetAddOns) and assigning the new dataset to the dataset field in the first dataset (ADODataSetServices.AddOns) but get the error message 'No matching ADO data type for Dataset', which I assume is referring to the AddOns field not finding a dataset.
You can use 2 datasets (master-detail) to show the relation between the Services and Addons and then using TClientDataset as memory dataset you can store the selections using the Service Id, Addon Id pair as Index, the structure of this client dataset can be created in runtime like this
ClientDataSet1.FieldDefs.Clear;
ClientDataSet1.FieldDefs.Add('IdService', ftInteger);
ClientDataSet1.FieldDefs.Add('IdAddon ', ftInteger);
//add morr fieldd here is you want
ClientDataSet1.IndexDefs.Add('Index1','IdService;IdAddon',[ixPrimary, ixUnique]);
ClientDataSet1.IndexName:='Index1';
ClientDataSet1.CreateDataSet;
and finally when you need pass the data selected by the user to the service you can iterate over the ClientDataset just as any TDataset.

Make Stored Procedure parameters cascading in Crystal Reports

I don't have a lot of experience using Stored Procedure as a data source for Crystal Reports. My question is that when you connect to an Oracle Stored procedure which has 2 parameters - Country and City, the parameters are already mapped in Crystal individually. Is there a way i can make these parameters cascading i.e. Country > City, either on front end or backend
After you add a stored procedure to the report, you should see the two parameters listed in the Parameter Fields section in the Field Explorer.
Edit one of the parameters, select 'Dynamic' from the List of Values picklist. Click the first row below in the Value column to select which field in your SP will contain the value (key) for Country. Do the same for the description. Click the second row to follow the same process for the City.
The parameters' values will be limited to what the SP returns.
If you publish the report to BusinessObjects Enterprise, it will create a BusinessView (and lots of other objects) to host the List of Values. This allows you to specify a broader (not just limited to the SP's result) set of values.

Delphi ADO + bookmarks

I am currently developing an application that uses databases dynamically.
meaning it is designed to work with any db, at any time, and any structures.
my concern is that I wish to "tag" or bookmark certain records, therefore I will require to use the Filter property to do some searching, and in the end, I wish to delete the filter, and be able to search through the bookmarked records...
however it seems the bookmark only work as long as the filter was set on that specified filter, so if I choose my second bookmarked item, i receive a totally different record than I expected, i.e. I did a filter, and bookmarked the first record, when I delete my filter and go to bookmark #1 I still just go to record nr. 1.
is there any other way to do this ? or is it required to do this in a different way ?
hope someone here has some mad genuine solution to this :)
A dataset in Delphi can bookmark only one record. TDataset.BookMark is the placeholder for that bookmarked record. A bookmark made while dataset was filtered is valid after the filter is gone too. So if you filter your dataset, and bookmark a record, then remove the filter, and go to your bookmark record, you should get to the same record.
If you are not sure if your bookmark is still valid, specially when your dataset is being edited; then you can use TDataset.BookmarkValid method to validate your bookmark.
If you want to have a list of bookmarks (not just one bookmarked record), then you have to save them in a list or array. In Delphi 2009 and newer versions, TBookMark data type is defined as TBytes. In previous versions, TBookMark is defined as string. So if you are using a version of Delphi prior to Delphi 2009, you can use an instance of TStringList to save your list of bookmarks. If you are using Delphi 2009 and above, you can use an instance of TList generic type (declared in Generics.Collections unit) to store the list of bookmarks.
If you are using DBGrid, DBGrid has a property called SelectedRows which is of type TBookMarkList. You can use it to save a list of bookmarks from selected rows in the grid. You need to enable multi-select in DBGrid's options.

Multiselect listbox bound to database in Delphi 6

I'm using Delphi 6, and I want a database bound list box with multiselect. I found three types of List boxes: TListBox, TDBListBox and TDBLookupListBox.
As far as I can understand, TListbox is not bound to database. TDBListBox and TDBLookupListBox can't be multiselected.
Is there a way to get a multiselect listbox binded to database?
The problem with databinding components is that they rely on a datasource and a datasource has only a single cursor. That is probably the reason why.
By the way, do you need to change the data? Else you could fill a normal listbox from a dataset. Or even use an invisible data listbox and copy the contents to a normal listbox.
Not as far as I know.
The standard is that you offer with the list a bunch of values in which 1 represents the current record.
Unless you have a multivalued field (against best practices) I can't see how you could multiselect...
Or what you might want is actually a sub-table?
DevExpress TcxDBListBox supports multiselect. I use their multiselect drop down check box bound to a database, it's sweet.
The components have methods you can implement to convert to and from your list; EditValueToStates and StatesToEditValue. While the data I store is not normalized (I store a semi-colon delimited list of version numbers), I created a full text search index on the field, with a semi-colon as a delimiter, and now I can still perform optimized searches on that field.
You could create your own custom listbox component that descends from TCustomListBox and add a Datasource property for your list, and another property such as TStrings to be used as a container to hold selected values. You could then post changes to your database using a button click.
If you fiddle with some of the options of a TDBGrid and restrict the columns it displays, you can make something that looks a whole lot like a listbox. Try setting the Options property to [dgTitles,dgTabs,dgRowSelect,dgAlwaysShowSelection,dgCancelOnExit,dgMultiSelect] and work from there.
In a TDbLookupListBox you have the option to bind two different things to data; first you can bind the list to a dataset (ListSource/ListField/KeyField), second you can bind the selected item to a field in another dataset (DataSource, DataField). There is nothing conceptually wrong with wanting to bind the list of items to a dataset, and then manually manage multiple selections, however I don't think it is possible with the current implementation without subclassing and enabling the required control styles.
Based on your comment to François, I would use a normal TListbox and write code to insert all distinct values into the list, and then handle the multi-select values yourself. Jeremy's solution also works, and the DevExpress Express Quantum Grid has a nice filter system which might even save you some other programming.

Resources