Read Only Table displays foreign key instead of details - oracle-adf

Summarize the problem
So I have a Department Table which has a column Location ID which references a Location Table.
FYI: (Department.locationID = Location.LocationID)
Now on my UI page when I drag and drop the department collection to make a table it displays the locationID instead of the location name. My end users won't understand Location ID, they'll need to see the locationName.
Provide background including what you've already tried
On my Department VO, I have referenced the locationID to a LOV so that it displays the LocationName. When the table is updatable, I have no issues, but when the table is read only the ID is being displayed instead of name.
I have read few blogs where they suggest to make the table column SelectOneChoice. Find the code snippet taken from my jsf page below.
Show some code
<af:column headerText="#{bindings.Departments1.hints.DepartmentLocationId.label}" id="c6">
<af:selectOneChoice value="#{row.DepartmentLocationId}"
shortDesc="#{bindings.Departments1.hints.DepartmentId.tooltip}"
id="soc1" readOnly="true">
<af:convertNumber groupingUsed="false" pattern="#{bindings.Departments1.hints.DepartmentLocationId.format}"/>
</af:selectOneChoice>
<!-- <af:outputText value="#{row.DepartmentLocationId}"
shortDesc="#{bindings.Departments1.hints.DepartmentLocationId.tooltip}" id="ot6">
<af:convertNumber groupingUsed="false" pattern="#{bindings.Departments1.hints.DepartmentLocationId.format}"/>
</af:outputText> -->
</af:column>
Describe expected and actual results including any error messages
After making the above changes (I commented out "outputText" section and added the "selectOneChoice" section) my location column doesn't display anything.
My expected output is for the table to display Location Name and not locationID.
I'm using JDeveloper 12c.

So just in case, anyone else faces the same issue, here is what I did as a workaround. It's not the exact solution to the above problem, but it works.
Instead of relying on VO based on one EO, I made a VO that's based on two EOs. the DepartmentEO and LocationEO. In the VO layer, both EOs should also be related with an association.
Now my DepartmentVO has an extra attribute called LocationName. On the UI front, I hide my LocationID and instead display the LocationName.

Related

Query of Arrays in Salesforce

I need to do 1 of two things (I believe):
1- Get a Custom Object ID so I can query it directly
2- Get a list of values of a specific field within the Object entries.
Ultimate End goal:
Add and modify rows in my custom object via external API. However to do this I need to check and make sure my new entry/row does not already exist.
What I have:
I have a custom object (called Customer_Arrays__c). It is a table that I can add new rows to (I will call entrys). Each entry has 6 or 7 fields. 1 of these fields is called (external_ID__c). This is the field I utilize to match to new incoming data to see if the entry already exists, or if it needs to add a new row to my table. This Customer_Arrays__c is a child to my opportunity I believe – it is part of every opportunity and each line item I add has a field defaulted to the opportunity.
Help I need:
1- How do I query the value of my Cutomer_Arrays__c based upon an opportunity ID?
2- How do I query a list of values in my (external_ID__c) based upon an opportunity ID?
Thanks for your help! I have read half a dozen+ posts on similar topics and am missing something. Examples of some Past try's that failed:
Select external_ID__c,FROM Custom_Arrays__c WHERE Opportunity='00...'
Select Id (Select ID, Custom_Arrays__c from Custom_Arrays__c) from Opportunity where id ='00...'
List FROM Custom_Arrays__c WHERE Opportunity='00...'
Select Id, external_ID__c, (Select external_ID__c FROM Custom_Arrays__c) WHERE Opportunity__c='00...'
Thanks again!
Only you know how did you name the lookup field (foreign key) from arrays to Opportunity. You'll need to check in setup, next to where external_ID__c is. Since it's a custom field (gets __c at the end), my guess is you went with default.
Try
SELECT Id, Name, External_Id__c
FROM Customer_Arrays__c
WHERE Opportunity__c = '006...'
Thank you eyescream, that got me almost all the way there. Turns out I also needed a __r for the parent child relationship.
Here is a snip out of my final code that works - I think it covers everything:
SELECT Field1__c, Opportunity__r.Id, Opportunity__r.Opportunity__c,
FROM Customer_Arrays__c
WHERE Opportunity__r.Id = '006...'.
Thank you so very much!!!

Is it possible to nest values based on key column in AppSheet?

I have a table connected to AppSheet that has a column called "Names" there are many values that have the same name with different information. Is there anyway in AppSheet to have the user tap on one name and have all of the values show up that have the same Customer name. Essentially grouping.
I know there is a community on Google Plus for AppSheet but it doesn't seem very active my question has been sitting on the site for weeks. If anyone needs more clarification please ask.
Not very clear what you are trying to achieve, but you can correct me if I'm wrong.
You want in the Inline view of any given Customer, to have a list of referenced values.
You can do this with a SELECT() function. In Data > Columns > + "Virtual column"
In the "App formula" input add your function.
For example: SELECT( myTable[myColumn], [Name] = [_THISROW].[Name])
What this does:
List all values from column named "myColumn" in table "myTable"
where "Name" has the same "Name" as this row,
https://help.appsheet.com/expressions/functions/select
If you want to list not only values but a list of referenced rows from another table, you should use REF_ROWS.
For example REF_ROWS("myOrdersTable", "orderCustomer")
What this does: list all rows from table named "myOrdersTable" where column named "orderCustomer" has the same value as the unique KEY of this row.
REF_ROW virtual columns are generated automatically when you give a "REF" type to any column. In this example if you go to Data > Columns > "myOrdersTable" and change the type of "orderCustomer" to "REF" with "ReferencedTableName" to "myCustumerTable", a virtual column with list of referenced rows will be generated in "myCustumerTable" table after you save.
https://help.appsheet.com/data/references/references-between-tables

How to create a table in adf with variable no of columns

Hello I am developing a web application using ADF (jdeve11.1.2.4). I know how to populate a table programatically from this post Programmatic ADF Table
But in the above post the no of columns are fixed (It is bean structure). But I cannot use the above post. Because I need to create a table with 'n' no-of columns. Means Columns are not fixed. Some times the columns may be 4 or some times the columns may be 7 and what ever it may be. Suppose I have two sqls and both contains differnt no of columns.
Ex: (suppose student is a table)
select id from student
select id,name from student
so in the above two sqls no of columns are diffent. I need to show the resul set of the above queries in a tablular format.
Please help me how I can achieve this.
Thanks in advance.
I wonder if declarative mode view objects would help? Blog here. So the query is not built until the UI is gen'd. You could dynamically generate the table and insert columns and then bind to the VO.
That's quite complex to do and it may require some extra study:
create a programatic view object by passing your sql statement using:
ApplicationModuleImpl.createViewObjectFromQueryStmt(java.lang.String voName,java.lang.String query)
try to construct af:columns in a loop:
<af:table value="#{bindings.EmployeesView1.collectionModel}" .. id="t1">
<af:iterator id="i1" value="#{bindings.EmployeesView1.attributesModel.attributes}" var="column" rows="0">
<af:column headerText="#{column.label}" id="c1">
<af:outputText id="d1" attributeModel="#{column}" value="#{row.bindings[column.name].inputValue}" />
</af:column>
</af:iterator>
</af:table>

Xpages Mobile Categorized View

I have an xPage for mobile with the following Code
<xe:this.categoryColumn>
<xe:viewCategoryColumn columnName="DC_SalesRep">
</xe:viewCategoryColumn>
</xe:this.categoryColumn>
<xe:this.extraColumns>
<xe:viewExtraColumn columnName="DC_CustomerName"
style="font-size:8pt">
</xe:viewExtraColumn>
</xe:this.extraColumns>
The column DC_SalesRep is categorized.
How can I hide the category title in the detail rows?
I notice that you haven't listed a Summary column. This is a required column. I would recommend using your extra column as the summary column and then if you want to provide a detail column, use the details facet. This should give you the outcome you're looking for. As for how this is all structured:
DC_SalesRep (CategoryColumn - collapsible)
DC_CustomerName (SummaryColumn)
Any detail column you add as either a column or a facet should show up as a div of text in the same row as the summary
column.

Database structure: how to best design for this issue?

I have users that have several objects and can upload images for those objects. Each object has several items. The photos the user upload can be assigned to those items. The thing is, one object can have one specific item more than once.
To give an example: objects are cars and items are seats, windows, doors, etc. A car may have 5 seats, but all seats are the same item. The description of the image should, however, still be "seat 1", "seat 2", etc. and the user can upload multiple images for seat 2 as well.
Till now I have the following tables:
objects: id, name
items: id, name
assigned_items: id, object_id, item_id, quantity
images: id, object_id, item_id
How would you best solve this issue?
The reason I use quantity is, because if type of the item changes, then most probably of all the items. E.g. 4 seats can become 4 wheels, etc. So, if there was a row for each assigned_item, lets say seat1, seat2, seat3, etc, then this would be more difficult to change, no?
Take a look at this model:
It allows you to:
Connect multiple items to multiple objects (thanks to OBJECT_ITEM table).
Connect the same item multiple times to the same object (thanks to OBJECT_ITEM.POSITION field).
Connect multiple images to an object-item connection (thanks to OBJECT_ITEM_IMAGE table). So, we are connecting to a connection, not directly to an item.
Name the image specific to the object-item connection (thanks to OBJECT_ITEM_IMAGE.IMAGE_NAME field), instead of just specific to the image.
Ensure image name is unique per object-item connection (thanks to UNIQUE constraint "U1").
NOTE: This model can be simplified in case OBJECT:ITEM relationship is 1:N instead of the M:N, but your own attempted model seems to suggest it is M:N.
NOTE: To connect an image directly to OBJECT (instead of OBJECT_ITEM), you'd need additional link table (OBJECT_IMAGE) in "between" OBJECT and IMAGE.
Example data:
OBJECT:
Car
ITEM:
Seat
OBJECT_ITEM:
Car-Seat-1
Car-Seat-2
Car-Seat-3
Car-Seat-4
Car-Seat-5
OBJECT_ITEM_IMAGE:
Car-Seat-1-Image1 "Seat1 Image"
Car-Seat-2-Image1 "Seat2 Image"
Car-Seat-2-Image2 "Seat2 Alternate Image"
Car-Seat-3-Image1 "Seat3 Image"
Car-Seat-4-Image1 "Seat4 Image"
Car-Seat-5-Image1 "Seat5 Image"
IMAGE:
Image1
Image2
Unless you actually mean that items can belong to multiple objects, using assigned_items is not helpful. If I understand you correctly, your main concern is that you sometimes have images that are for part of an item, so how do you describe the image?
Here is what I suggest:
OBJECT: id, name
ITEM: id, name, quantity, object_id
IMAGE: id, name (null), object_id (null), item_id (null)
If your DBMS supports constraints, have a constraint on IMAGE to enforce one or the other of object_id or item_id (but not both). This allows you to define the image as being either for an item or for the object as a whole.
When you query for the name of an image, you would use the COALESCE function (or your DB's equivalent) to pick up the image override name (if it exists) or the object/item name (if the override doesn't exist).

Resources