Change the displayed value in adf table - oracle-adf

I am new working with ADF and Business component
I have a table with a columm with the department ID. This table is filled from another JSF page
I want to show the department name instead of the department Id
I have Business component with the view from my department table.
But I dont know how to show the department name instead de id in the adf table
My adf table is read only

you can create an LOV.Here you can select the type of attribute you need to display for the user externally(DNAME in your case) and type of value you need to store internally(DNO in your case) depending on the selected display value by the user.
Refer this link for LOV creation
http://techblogoracle.wordpress.com/2013/10/14/how-to-create-list-of-values-lov-in-oracle-adf/

Create a LOV in your VO for that property! Then you have two possibilities: 1- Reinsert your table in your page 2- Insert (re-insert) only the attribute that you need as a read-only column in that table!

To display the name of a department instead of the departmentId, create an LOV on the departmentId attribute in the view object that the ADF table is based on, pointing to the department view object.
To update your existing read-only table, remove the departmentId attribute from the JSF, and re-add it. Make sure that the new attribute is an "ADF select one choice." After the column has been added, select the select one choice drop down, and change the read-only attribute to true.
<af:selectOneChoice value="#{row.bindings.DepartmentId.inputValue}"
label="#{row.bindings.DepartmentId.label}"
required="#{bindings.Employees_VO1.hints.DepartmentId.mandatory}"
shortDesc="#{bindings.Employees_VO1.hints.DepartmentId.tooltip}"
id="soc1" readOnly="true">
If you run this page now, it should display the name of the department, instead of the id, while still being read-only.
How to show departmentName instead of departmentId using an LOV - ADF

If you're in the same taskflow or you share Data Controls and you don't want to change your VO to be based on two EOs, you can add a Transient attribute with the name, you will populate the value in the page that fills the data. Using LOVs it's too much of a headache. If the LOV list is big you will have performance issues that you introduce trying to solve a problem in a wrong way.

You can add referenced attributes to your VO.
So create a VO that is based on Emp and Dept together.
For example see the video here: https://blogs.oracle.com/shay/entry/whenvalidateitem_trigger_in_ad

use lov or use groovy Expression if number of values is not more than 2 or 3 values
usage : #{row.code eq 'A' ? 'Approved' : 'Rejected' }

Related

MS Access 2013 - How to Trigger an Event on an Automatically Updating Textbox

I have been banging my head against the wall for a while trying to get this to work.
I have an Access 2013 database. The db has a subform with a RecordID, Business Name, and Primary Contact in a continuous form.
I have the active record being highlighted at this point.
The RecordID, Business Name, and Primary Contact fields are being passed up to the parent form so they can be used later for other sub-forms/purposes. I have a text-box in the middle of the parent form that I want to show the active record name in.
If the business name is empty I want to display the primary contact name and if the primary contact name is empty I want to display the business name.
I have gotten the if statement to work if i put the code in the OnClick event and I click on the RecordID text-box. Is there a way to trigger the event when the RecordID automatically changes without my interaction with the RecordID text-box.
the easiest way to do this is to set the control source of the ActiveRecordNameTextBox to an expression. Experience tells me you probably tried this but had trouble referring to the subform. I always have to use areference when I refer to subforms. Here is a reference that also gives some explanation:
https://www.fmsinc.com/tpapers/primer/index.html
if and only if is a natural choice for the expression given you want to select between two values. So if you want to refer to the subform controls use something like:
=IIf(IsNull(Forms!MainFormName![SubFormName].controls("BusinessNameTextBox")),Forms!MainFormName![SubFormName].controls("PrimaryContactTextBox"),Forms!MainFormName![SubFormName].controls("BusinessNameTextBox"))
You could also refer to the subform recordsource fields directly. Also when refering to a subform from the mainform you can use relative references to get:
=IIf(IsNull([SubFormName].[Form]![BusinessName]),[SubFormName].[Form]![PrimaryContact],[SubFormName].[Form]![BusinessName])
Note since you weren't explicit about the edge cases Like what to do if you have both a BusinessName and a PrimaryContact I just picked displaying the BusinessName if available and nothing if both where blank.

SSAS - Dimension Browser Shows Different Attributes

I have a table in the data source view with UserID (PK), Department, UserName (and other irrelevant attributes).
I create a dimension. I select UserID as PK. I select Department as attribute.
So, now I have a dimension table with attributes: UserID, Department.
I create a hierarchy with Department->UserID.
I go to the browser, click All and then it starts showing me values from another columnn that isn't Department. If I expand further down into the UserID level, it shows me the values from UserName instead of UserID.
What the heck is going on here? It is showing me values from an attribute that I did not even include in my dimension. How is this possible?
Did you check attribute relationship view? However you create the dimension and the hierarchy it can be mixed up in attribute relationships so you will have to set the drill logic manually.

How to populate a text item from Oracle table using Oracle forms (Middleware) 11gR2

I am using Oracle with Oracle Forms builder (Middleware) both 11gR2. I am creating a system for purchasing records. I have the following 2 tables.
(a) product (master) : prodid(PK), prodname ...... etc.
(b) purchase (detail) : prodid(FK), quantity, ...... etc.
My plan: All the product details will be in the product table. purchase table will be used only to input purchase information. This table can't input any new product. If any new name, that info will have to be input into product table first. This way I can reduce duplicate names.
Now I am having difficulties relating to prodname (name of the product) column in the form.
I created forms using the purchase table only. This table does not have the prodname (because I put this field in product table) column. But during data entry, they need to see the product name !
So I created text item (tabular, database - no). Then I created LOV, attached to text item, input the prodid in prodid field in the form. LOV part is fine.
I run the form. click the text item, LOV appears, select a name, click OK. product name, product id, etc. appears in their fields as it should be. LOV is working fine. Now I can only input data but having difficulties updating. I mean if I input a name (LOV) in the text item, press execute query, shows records from the database but names in the text item disappear. Since the name is not here, it's not comfortable to update.
I think LOV is not the good idea here. May be I need to use PL/SQL in a trigger somewhere.
But I could not figure it out. I searched google but no luck. Is there anyone who can give me any idea or some example code/trigger please.
Since the product name is an non-database item, when execute query runs, the field is cleared and since no column is assigned to that field, it doesn't repopulate.
The usual way to populate this field is to have a function which returns the product name based on the id that is pressed and call the funtion in POST-QUERY trigger.
Basically it's a pretty simple task but I was having difficulties due to the lack of my experience. However, what I have done is -
create the text item (name : product_name) in the canvas
set properties for the product_name (database : No, .... etc as needed).
Create a block level POST-QUERY trigger and write the PL/SQL block to populate the field. For example, I wrote the following.
BEGIN
SELECT prodname INTO :purchase.product_name
FROM product WHERE product.prodid = :purchase.prodid ;
END ;
That's it and when perform execute_query in the form, it will bring the product name from another table. - Query problem is solved.
Now create an LOV using product table to bring the product name and product id.
Associate this LOV to the product_name text item. So whenever you need to input information about a purchase, just use the LOV to populate the product name field. And then input the subsequent fields as well.
This way both of my issues (query and data entry) are resolved.
I did this according to the suggestions given by Sathya and a video (6 minutes) from the youtube at https://www.youtube.com/watch?v=0nqldnGt8KA.
Thanks to Sathya and youtube.

soql getting data via a junction object

I have the following three custom objects:
Order__c
Design__c (has a lookup to Order and a lookup to Location, so the design ojbect is the junction object)
Location__c
On the order page layout I want to add a blank section that contains a VF page in order to display the Location records for all the design records for an order.
An order can have many designs and a design can have many locations. I need a way to group and display each design/locations in the VF page on the Order.
How can I build this query and display the results on the VF page?
I was trying a query like this: Select Location_r.Name, Location_r.Mockup From Design_c where Order_c = 'xxxxxxxxxxxxxx'
Also, is there a better way to display the results besides a VF page section in a related list?
Thanks for any help!
Regards.
First things, first. since design is related to the other 2 objects via lookup, it is not a junction object. junction objects are only when it's 2 parents have a master-detail relationship with the child.
I think what you're trying to achieve is to traverse a parent-child-parent relationship. You'll need to use subqueries for the last half. From the documentation- here you go: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm
Query **child-to-parent relationships**, which are often many-to-one. Specify these relationships directly in the SELECT, FROM, or WHERE clauses using the dot (.) operator.
For example:
SELECT Id, Name, Account.Name
FROM Contact
WHERE Account.Industry = 'media'
This query returns the ID and name for only the contacts whose related account industry is media, and for each contact returned, the account name.
Query **parent-to-child**, which are almost always one-to-many. Specify these relationships using a subquery (enclosed in parentheses), where the initial member of the FROM clause in the subquery is related to the initial member of the outer query FROM clause. Note that for subqueries, you should specify the plural name of the object as that is the name of the relationship for each object.
For example:
SELECT Name,
(
SELECT LastName
FROM Contacts
)
FROM Account
The query returns the name for all the accounts, and for each account, the last name of each contact.

Adding an order for a customer selected from a list view in Access

I followed this great guide to help me add a search feature to my Access database:
http://www.techrepublic.com/blog/howdoi/how-do-i-populate-an-access-list-control-with-the-results-of-a-dynamic-search/108
At the end it says:
"If you’re building a quote or order, use the list control’s Click or Double Click event to copy record(s) to a temporary table. It’s easy to implement using a fixed query for each search task."
I have managed to display all search results in a list box and I would like to be able to click on a customer to highlight them, and then press a button to add an order to the selected customer. I've been thinking how I could do it and I really can't get my head around it.
Any help would be appreciated.
It depends on how you build your database. My guess is that one easy way would be:
Create a table with customers;
Create an "Order" table with orders where you link the customers through a foreign key
You load the customers in a listbox. While making the name visible, it is actually the ID that you retrieve when clicking the listbox. You can configure this via the wizard in the design view of a table. You can make other forms appear by events on the listbox (eg. on click).
If you managed to retrieve the ID of the customer, and you have the data related to the order (data that can easily be extracted from form objects and loaded into variables ) what you need is an insert statement and insert the values in the "Order" tabel (including the customer ID, which is linked through the foreign key).
This way all order records are linked to the customer and can be queried later.
Due to my limited knowledge on your other requests, I cannot help you any further on the rest of your database design.
I hope that my reply could help you and that I understood your question correctly.
You can access info from a listbox via:
List.Value
Or if it is not the first column then:
List.Column(0,0)
0 being the column and row references.
You may also consider using a listview over a listbox and then you can access the relevant parts of a listview control with the following code:
ListView.SelectedItem
Or if it is not the first column then:
ListView.SelectedItem.SubItems(3)
3 being the column reference

Resources