LibreOffice Base subform displays unrelated records - openoffice.org

I would like help solving a problem with a LibreOffice Base subform. I think the subform should be displaying only the records that are related to the record displayed in the parent form. But the subform is actually displaying every record in its data source, regardless of the relationship to the record in the parent form.
The parent form displays a manufacturing work order. It draws data from a query Work Ticket Traveler which consists of fields:
WorkTktRecordNo
Number
Date
ItemID
ItemDescription
DisplayQty
DisplayUOM
The subform displays materials needed. It draws data from a subquery WTT Subform which consists of fields:
WorkTktRecordNo
ComponentNo
ComponentRecordNo
QtyRequired
You can readily see that the link field is WorkTktRecordNo. In the subform properties, the link master field is WorkTktRecordNo and the link slave field is WorkTktRecordNo. So this should cause the subform to display records from the subquery which are related through WorkTktRecordNo.
The only control in the subform is a table control which displays the four fields. This table control is the one with the problem: it displays every record in the subquery.
client: LibreOffice 4.1.5.3 (Windows 7 Pro SP1)
server: Pervasive PSQL v10 SP2 Workgroup (10.12.16.0), via ODBC (Windows XP SP3)

Did you typed these field names or you selected them using the buttons? Selecting from the drop down boxes will paste the appropriate field name.

Related

Creating a duplicate record in MS Access using Append Query

I have a table "Tbl_Invoice" with invoice details [Primary key "InvID"] and another table "Tbl_Invoice_Details" with the invoiced item details (items, quantity purchased, rate, amount, total) [primary key "InvDetID" and foreign key "InvID" linked to invoice table]. In the main form "Frm_Invoice" with data source "Tbl_Invoice", I have included a subform with item details from the "Tbl_Invoice_Details".
I have two problems -
The subform shows the total of all the items purchased in the footer (using the sum function from the menu bar). But I am unable to bring the total of the subform to the main form where the discount is calculated, tax added, rounded off (if necessary) and calculates the invoice amount.
I want to create a duplicate record (total invoice with items, etc.) only the customer name, invoice no., date changes. I am using two separate append queries, one for the invoice details and the other for the invoiced item details. Both works. The problem is I am unable to link the new records in the subform/subtable "Tbl_Invoice_Details" with the new record in the main form / main table "Tbl_Invoice".
I am a newbie and do not have much knowledge of VBA. Please help!
As for your second question, use the RecordsetClone of the main form and the subform respectively to copy the main record and the subrecords:
Duplicate records in Subform to New record
For Question one look at the two images, i have attached.
Name of subform in my case is BILLINGDETAILS
Name of control in subform is TOTALPAID,with caption Text2(caption is not relevant to the outcome)
Look closely at how the TOTALPAID control in subform is referenced from the Main form.
For your question two, if you can share the tables relationship window and image of the form link fields , you will get someone in this forum that will answer it.

Unable to create a QuickReport portraying a one-to-many relationship in C++ Builder 6

I am attempting to create a report using QuickReport in C++ Builder 6 and cannot produce the results I require.
I have attempted to create this report in two ways with marginal success. I've detailed one attempt below as it appears to be the most promising. I am new to QuickReport and have no idea where else to look for help. The documentation I've found online at http://www.quickreport.co.uk/ is minimal and does not adequately explain how to use the product beyond extremely simple reports.
The report should be formatted as such:
Manufacturer 1
A product
Another product
Yet another product
Manufacturer 2
My product
This product
Attempt 1: Two queries separating Manufacturer and Product data
Create a TQuery that gets a collection of Manufacturers by their IDs.
Create a Detail band.
Set the DataSet for the report to the Manufacturer TQuery.
Create Manufacturer Name QRDBText field on the Detail band associated with the Manufacturer TQuery and Manufacturer Name field.
Create a TQuery that gets a collection of Products by their Manufacturer's ID which is a parameter to the TQuery.
Create a Sub Detail band.
Set the DataSet for the Sub Detail band to the Product TQuery.
Create Product Name QRDBText field on the Sub Detail band associated with the Product TQuery and Product Name field.
Create events for the Sub Detail band:
BeforePrint:
Takes the current Manufacturer ID and insert it as a parameter to the Product TQuery
Activates the Product TQuery
AfterPrint:
Deactivates the Product TQuery
Result: This almost gets me what I require. It displays every Manufacturer properly, however it only displays the first Product for each Manufacturer. I'm not sure if I'm incorrectly expecting the Sub Detail band to iterate through the results as the Detail band does, or if I'm missing some other necessary step to make it work. I've also considered using Loop or Child bands, but neither appear to offer the functionality I expect. Again, I can't seem to find decent documentation explaining QuickReport at all.
In the end, I can't determine if I'm expecting functionality QuickReport doesn't offer or if I'm thinking about this all wrong.
The solution:
Create a TQuery that gets a collection of Manufacturers by their IDs.
Create a Detail band.
Set the DataSet for the report to the Manufacturer TQuery.
Create Manufacturer Name QRDBText field on the Detail band associated with the Manufacturer TQuery and Manufacturer Name field.
Create a TQuery that gets a collection of Products by their Manufacturer's ID which is a parameter to the TQuery.
Create a Sub Detail band.
Set the DataSet for the Sub Detail band to the Product TQuery.
Create Product Name QRDBText field on the Sub Detail band associated with the Product TQuery and Product Name field.
NEW! Set the Detail band's LinkBand property to the Sub Detail band.
NEW! Prior to Printing/Previewing/etc. the report, in code set each query's Active property to True.
NEW! After Printing/Previewing/etc. the report, in code set each query's Active property to False.
The part that really threw me off was the "magic" that occurs wherein you needn't specify the parameters between the data source and the query for Products. It appears that if you specify a parameter required for a query pointing at a dataset then the query will look for a field sharing that name and match them.
I hope this helps someone down the road.

How to show selected items of certain table on the different table in Dynamics AX 2012?

So, I have two tables InventTable (for inverntory) and MyCartTable. I want to connect this tables so when I chose some item or items in InventTable to show in MyCartTable's grid. MyCartTable fields are ItemNumber, ProductName, PartyID;
Assuming you are working with AX 2012:
On your MyCartTable, remove the itemNumber field.
Open an other AOT windows go to Data Dictionary - Extended Data Types and locate the itemId data type. Drag and drop this data type on your table. AX will ask if you want to add a foreign key relation. Click yes, this will add a relation to the InventTable to the relations node of your table.
Now on your form, set the JoinSource property of your MyCartTable to you inventTable data source.
If you are having trouble making this work, create a new form with only those two datasources and a minimum amount of controls (like just 2 grids), this allows you to test this more easily.

How to use MasterSource and MasterFields capability using FibPlus datasets or FibQuery

I am rewriting an existing BDE database program to use Firebird using the FibPlus components.
Since I almost every where used TQuery components, the change is fairly straightforward.
Apart from one thing I dont't seem to find :
In one of my forms I have two grids above each other, linked to TTable components, where the grid below only displays records with the same key as the selected record in the upper grid - so master/detail relationship.
This was done easy in BDE using the MasterSource and MasterFields properties.
How can this be achieved using the FibPlus FibDataset or FibQuery components ?
I don't think it's possible with a FibQuery, but with a FibDataSet there is a DataSource property which you should point to a DataSource connected to the master DataSet.
In the Detail fibDataSet a where clause shoudl be used where the parameter has the same name as the master field for the detail table in the master table.
For example:
master pFibDataSet CustomerspFibDataSet with the following SQL:
select cusotmerid, name, address, country from customers
A master DataSource CustomersDataSource with property DataSet set to CustomerpFibDataSet
detail pFibDataset OrderspFibDataSet with the property DataSource set to CustomersDataSource and the following SQL:
select orderid, date, amount from orders
where customerid = :customerid

Editable detail records in Delphi DBGrid

I have a database (held in an Access .MDB file) that records staff members, and any absence they have e.g. holiday, sickness, training course, the start and end dates, and hours of productive time lost.
I then have a dbgrid bound to an "master" ADO query that finds all staff meeting the selected criteria of date range, department, search string for name, summing up the hours of productive time lost.
I have another dbgrid bound to a "detail" ADO table containing the absence records.
The desired effect is that the detail dbgrid should only contain those records from the Absence table that match the row selected in the master record (both "master" Staff and "detail" Absence tables contain a common EmployeeID field).
Though I can achieve this using ADO Queries created on the fly, changing the query each time the user moves to a different master staff record, I was hoping to use the detail DBGrid as my main method of deleting, updating, and adding additional absence records, complete with in grid lookups; so user can select record types without having to remember the code for that type.
I would also like the changes in this detail grid to be reflected in the summaries in the master dbgrid.
I have achieved this using a detail ADOTable linked as MasterDetail to the Staff Query, but need to have filtered set to True, and control the onfilterevent in code; but as the database increases in size this is getting slower and slower.
Is there anything I can do to improve this performance, or will I be forced to have the detail dbgrid as purely read-only, and all Absence records entered through another form or panel?
More information on Making the Table a Detail of Another Dataset
ADOTable2.MasterSource := DataSource1;
ADOTable2.MasterFields := 'EmployeeID';
I would also like the changes in this detail grid to be reflected in the summaries in the master dbgrid. After editing the detail table and posting any change you may use the AfterPost event to recalculate the summaries.

Resources