I want to create a table that will include different columns from different tables. I am trying to do that as a visualization not transforming data - filter

I want to create a table that will include different columns from different tables. I am trying to do that as a visualization not transforming data.
When I try to select the columns that I want to add to the table- only unique values appear. I tried changing the relationships to Many to many. I also turned off the "Keep all filters" button. However, I still cant get all the values.
When I try to select the columns that I want to add to the table- only unique values appear. I tried changing the relationships to Many to many. I also turned off the "Keep all filters" button. However, I still cant get all the values.

Related

Any way to intercept an error message and make more user friendly?

I have looked for an answer here among other places but havent quite been able to find what I need to know.
I have 3 tables, Order_Details, Products_Ordered and Product_Details. The first two are being used in a master detail form to show the order and the items ordered together. The Products_Ordered table has a composite primary key made from two foreign keys, the first being the primary key from the Order_Details table, and the second being the primary key from the Product_Details table. Together they ensure that a type of product can only be added to an order once. If someone wants to order more than one product then the quantity field in the record can be altered to reflect this. All that seems fine so far.
My issue is that when adding products to the order in the master detail form i have used a drop down list of values to select the product to add to the order. the display value for this is the product name and the return value for it is the primary key for the product from the Product_Details table.
I like this because its easier for the user to simply select the product and add a quantity of it to the table. And it works fine for both insert and update operations apart from one situation.
If the user selects the same product in to rows then submits the table the database then tries to add the product to the order twice, throwing a "ORA-00001: unique constraint violated." error. Obviously this is because of the product ID being used in the primary key of the table.
I don't want to allow the user to add two records to the table like that, rather id like to force them to alter the quantity field accordingly. The error message that comes up isn't very user friendly so my question is how can I detect this error and display a more user friendly one instead telling them to alter the quantity field instead?
*If this isn't possible then is there a way that I can hide any already selected products from the dropdown list of values in the following table rows? I haven't looked into this too much because surely it would get complicated when the user tries to add more rows than products available in the dropdown and there are no more products values to show?
I am quite new to this so please be nice. Any help is greatly appreciated :D
Here is a link where all is nicely described:
https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/07_errs.htm
Section
Predefined PL/SQL Exceptions
in combination with:
Defining Your Own PL/SQL Exceptions
and
Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR
Hope it helps...

Ordering records by foreign field while maintaining adding capability

I have an Access form that lists all records in a table. One column in that table refers to a 'device' table, which then has a foreign key reference to a 'brand' column. In the form, the brand name + device name are displayed due to some magic in a combo box for every row.
The question: how can I sort this form by the brand name, while still retaining the ability to create new records? This is my current query:
SELECT ehs.*
FROM ehs, brand, device
WHERE brand.ID=device.brand_id AND ehs.device_id=device.ID
ORDER BY brand.brand_name, device.model;
Apparently (and understandably), you cannot add records when the query has a join in it. What would be a better approach to sorting the list?
You can create a form that has a foreign key in the query that allows adds and updates. I've just done this in Access 2010 to confirm.
It's possible that some of the magic you mentioned with the combo boxes has broken the ability to do so.
Note: I've just noticed I've used DeviceName where you've used model - you'll need to adjust the SQL below.
There are some tricks, though:
Make sure all of your tables have primary keys (hard to avoid in Access)
Make sure all your foreign keys are indexed (so brand_id in device table, and device_id in ehs table) - duplicates ok.
Use the relationships diagram to draw the relationships between these tables
I then created a query - I just used the query designer, so Access' interesting brackety arrangement is all its own doing:
SELECT ehs.*
FROM (Brand INNER JOIN Device ON Brand.brandID = Device.BrandID) INNER JOIN ehs ON Device.DeviceID = ehs.DeviceID
ORDER BY Brand.Brandname, Device.DeviceName;
If you view that in a data sheet view you should be able to add a record. That's important, if you can't there's a problem, if you can then we're on the way.
If this works, then I'd suggest create a new form based on this query and verify that the new form allows you to add records. This new form is basically going to have an id number for device_id. So you'll have to type a number to make it work.
The trick you're going to want to perform is, and I'm guessing the thing that's causing you problems:
To have a "brand" drop-down that you choose a brand, which then limits the options for the device drop-down.
That's REAL tricky (and I'm afraid I'm somewhat rusty in Access, and it's not in the question, really).
What you CAN do, easily, instead, is have a drop-down for device, that includes the brand name, and sort that appropriately.
I added a combo box to the form. The wizard takes you through using a table or query, I just chose the device table (we'll tweak this later), and the fields - you need device_id model and brand_id, and what to display (model and brand_id - we'll tweak it) and it hides the primary key. When it says "do you want to save it for later or store it in this field, choose store it in this field and choose device_id (which is in the ehs table).
When the wizard completes, click on the new combo box, and get the properties for it. Switch to the Data tab, an there's a builder [...] button next to RowSource. Click that, you get a query builder. Add the Brand table and show the brand_name field and hide the brand-id field. (We just chose that so the combo box has two columns). Sort as you like.
When you close it, it will ask you if you want to save it, so say yes. Your SQL will be something like (with appropriate field name changes because of my mistake):
SELECT Device.DeviceID, Brand.Brandname, Device.DeviceName
FROM Brand INNER JOIN Device ON Brand.brandID = Device.BrandID
ORDER BY Device.DeviceName;
Your form should now have a combo box that shows the device name when not selected, and device name and brand name when you select the drop-down.
You can then delete the original device_id text box from the form.
And you can also add the brand name to the source query and add it as a text field on your form, so you can see the brand next to the device, even when it's not in the drop-down.
The primary query for the form can be:
SELECT ehs.*, Brand.Brandname
FROM (Brand INNER JOIN Device ON Brand.brandID = Device.BrandID) INNER JOIN ehs ON Device.DeviceID = ehs.DeviceID
ORDER BY Brand.Brandname, Device.DeviceName;
You can add BrandName as a text box - you don't need devicename (model) because this shows in the combo box.
And you should still be able to add records.
So, not ideal, but a lot simpler than coding up a bunch of VBA, which is where I think you'd need to go if you wanted to separate your combo boxes (not sure), especially as that's not the original question anyway.
I suggest you do each step and verify that it's still working at each stage.
Good luck.

Custom columns on a strongly typed DataTable

I am using typed datasets to retrieve and manipulate data. To generate a typed dataset I use the built-in dataset designer and drag-drop tables from data sources. In addition, mostly I need to add custom columns to my data tables.
The problem is that when I make a change in the underlying database schema I simply delete and regenerate the data table and loose all the custom columns that I added earlier. So everytime I regenerate a data table I had to add these custom columns again and again.
So my question is that if there is an easy way to mantain or keep track of these custom columns?
Don't delete the DataTable and regenerate it. Instead right-click, choose configure and adjust the query to add/remove your new columns. Then click finish and the table will be updated in the DataSet but without deleting your customisations.

FileMaker Pro -- Filtering Relationship Not Working

I'm trying to build a FileMaker Pro 11 layout that excludes records containing a certain value. The relevant data is in table Invoice. I want to filter so that Invoice records whose "Invoice Check Grouping" field is blank are not displayed on the layout.
I've added a global field to the invoice table called "Blank Invoice Check Grouping" to use as my filter criteria. I've created a self-join relationship to the Invoice table, joining "Invoice ID" to "Invoice ID" and joining "Invoice Check Grouping" to "Blank Invoice Check Grouping". The resulting table is named "Invoice Check Groupings".
The layout which I build based on table "Invoice Check Groupings" shows all records in Invoice--it does not filter out those with blank values. What am I doing incorrectly?
Thanks,
Ben
Layouts show records in a table (or more accurately, a table occurrence) and don't directly deal with related data. As mentioned by #pft221, you can use relationships for filtering, but only when viewing data through a portal.
If you always want a particular layout to show data based on a particular find, you can do so with a script and a script trigger. First set up a script to do the following:
Enter Find Mode[]
Set Field["Invoice Check Grouping"; "*" // Find all records with any data in this field
Perform Find[]
Note that you can also embed the find request within the Perform Find script step, but I tend to script finds in the above manner as it's easier to see what the find request is in the script and variables can be used in the find request.
Now you need to set your layout to execute this script whenever it's loaded. Go to the layout and enter Layout Mode. Select Layouts>Layout Setup from the menu bar. Click the Script Triggers tab and check the box for OnLayoutEnter and select the script you wrote above. Now whenever the layout is entered, that script will run and exclude the records that have that particular field being empty.
There are many ways to filter records, depending on what you are trying to do and what you are trying to display for your users.
The most common and simple way you can filter records is through a simple Find in a list view. I'm unclear from your question, but my best guess is that you're already using a list view and misunderstanding how FileMaker's relationships and Table Occurrences (TO's) work.
To Filter with the "Find Records" method:
Create a new List View layout of any Table Occurrence of your Invoice Table -- most likely you will want to use the default Table Occurrence that FileMaker created for you when you created the table.
Place the fields that you would like to display on that layout, including the "Invoice Check Grouping" field.
Switch into Find Mode
Put a '*' character into the "Invoice Check Grouping" field
Perform the Find
You should now see a list of all Invoices where the "Invoice Check Grouping" field is not blank. (You can find additional interesting search criteria in the "Insert: Operators" drop down of the title bar.)
Now you may actually be looking to filter related records through a portal but, given that you've set up a self-join on the Invoice index on the Invoice table my guess is that, at best, this would show either 0 or 1 record for each Invoice record you display in your main layout.
To Filter Records with the "Portal Filter" method:
Let's assume, though, that you have a Client table where you'd like to see only the records with a non-blank "Invoice Check Grouping" value. The table set-up would be as follows:
Client
Client ID
[... other client info ...]
Invoice
Invoice ID
Client ID
Invoice Check Grouping
[... other invoice info ...]
With a relationship in the relationships graph:
Client::Client ID ------< Invoice::Client ID
From there you would set up a Form layout on the Client TO and create a portal showing records from the Invoice TO. From the options for the portal you would select "Filter Portal Records" and use a formula similar to:
not IsEmpty(Invoice::Invoice Check Grouping)
Finally, it's worth noting that a portal filter isn't appropriate for all display situations or calculations. You can set up a similar filter completely through your relationships graph (as I believe you have already tried to do.) This will work, once again, for viewing records through a portal but not for the records displayed by a layout itself.
The answers above don't actually help Ben with his question. They are workarounds.
I have the same problem as Ben, and I don't think there is a solution, even now in Filemaker 12. There is I think no way to define a relationship that will omit the related records where the match fields are empty.
Two options come to mind:
On a specific layout, you have more fine-grained control in the portal definition itself, and can use this to exclude the records
You can now use SQL queries to achieve this result within Filemkaer.

database driven form controls

How to do databse driveen jsp page,
Suppose i have 5 text fields,if user wants to put one of the form field as select box.JSp should identify and return the select box if it define in db as select box.
I dont know how to achieve this,can anyone suggest this.
Regards,
Raju komaturi
There are multiple tasks if you want to do this completely. The world at large has not gone this way and so there are not many tools (if any) for this. But basically here are the main ideas.
1) You want a "data dictionary", a collection of meta-data that tells you what the types and sizes of each column are, and the primary and foreign keys are.
2) For your example of "knowing" that a field should be a drop-down, this almost always means that column value is a foreign key to another table. Your code detects this and builds a listbox out of the values in the parent table.
3) You can go so far as to create a complete form generator for simple tables, where all of the HTML is generated, but you always need a way to override this for the more complex forms. If you do this, your data dictionary should also have column descriptions or captions.
There are many many more ideas, but this is the starting point for what you describe.

Resources