How to make drop-down menu within Oracle Application Express? - oracle

I would really appreciate if anybody could shed some light on this, as search engine results have been singularly unhelpful so far.
I am attempting to build a GUI for an oracle database through Application Express. There tend to be tricks of how to set up drop down menus through the Graphical User Interface of the product that one uses (for instance I would know how to do this in a product like Microsoft Access).
For instance I have this form
The foreign key for Business (FK_BUSINESS_ID) is just an integer - not terribly user friendly! If it could be a drop down list of business names (BUSINESS.NAME), it would be great. Hiding the business primary key (BUSINESS_ID) would make it look nicer, but isn't altogether relevant.
I have found the source controls for the element in question.
What sort of SQL (or even PL/SQL) could be used to both display this data from the other table, and return the selected foreign key selected by the user when the form is sent?

Solution
Open up the item, and change the type to Select List
For List of Values Definition, enter select BUSINESS.NAME, FK_BUSINESS_ID from [TABLE]
Explanation
Select list shows display values to the user and returns the corresponding ID. Your source can remain the same as before.

Related

Model-driven PowerApp: Best practice to display subgrid of records with no appropriate primary column name

Background
Each Dataverse table contains a primary name column. When displayed in a subgrid, clicking on the primary name column will navigate to the form so that the user can edit that row. Most subgrids in my application work this way.
The Problem
I have a Course form with a list of participants displayed in a subgrid. The subgrid displays each student's name (as a link) and the grade received in the course. There is no appropriate primary name column for this Participant table. To edit the participant record, the user must select the row in the subgrid, then click the subgrid's Edit button. As a result, this UI is different from all other subgrids in the application and I know that user's will click the student name to try to edit the participant record and be confused when they are presented with the student record.
Am I missing something? Is there a better way to handle this?
It's a common problem I face quite often. Here is usually what I would do.
Make sure the Primary Name Column always contains relevant information to the user to be able to quickly identify a record. Sometimes it requires copying information from one or multiple other columns into the primary column.
In your case that would probably means concatenating the student's name and grade.
How to do that?
Common to all solutions below
Use one of the following solution to copy the content of one or several fields into the primary column.
Make sure the solution you select also updates the content of the primary name column when one of the copied field is updated.
Remove or hide the primary column from the form, the name of the record will be displayed at the top of the form anyway and you probably don't want users to play with it.
Display the primary name column in every subgrid.
I would recommend not adding the fields copied into the primary column in the subgrids to avoid confusion.
Solution 1 - Classic Workflow
Create a classic workflow that runs when a record is created / updated
Pros:
Very quick to put in place
Runs synchronously (users will see the name updated in real-time)
Cons:
Not very practical if you need to add business logic (using different fields as source depending on a certain condition for example)
Solution 2 - Power Automate
Create a Flow that runs when a record is created / updated
Pros:
You can implement complex business logic in your Flow
Cons:
Runs asynchronously (users will have to refresh the page after the creation of a record to see the record's name)
According to Power Automate licensing that flow would certainly be considered as an "enterprise flow" and you are supposed to pay 100$ / month. That specific point must be taken with a grain of salt. I had several discussions with Microsoft about it and they haven't given me a clear answer about what would be considered an enterprise flow.
Solution 3 - Plugin
Create a plugin that executes when a record is created / updated
Pros:
You can implement very complex business logic in your Flow
It can run synchronously
Cons:
Pro-code (I put it as a con since Model-Driven App is a low-code / no-code approach but there is nothing wrong about pro-code per say)
Developing a new plugin for each entity where you need this logic is kind of overkill in my opinion. I would consider developing something very generic that would only require some sort of configuration when the logic needs to be applied to a new table.

ORACLE ENGINEER TO RELATIONAL how do i control key names generated?

Working on a school assignment, building databases. First I built my logical model of my database (Using Oracle SQL developer data modeler). There's this little blue arrow button (engineer to relational) which will take your logical model and attempt to create a relational model.
WHEN it does this, it will automatically generate names for your foreign keys. This part infuriates me because it creates these ridiculous named foreign keys, I'm simply looking for a way to turn this feature off (OR I'm open to whatever suave way they actually deal with it) Because so far, I have to go back and meticulously rename all my foreign keys throughout the database.
As a specific example, I have a Client entity, with a unique ID called Client_ID. After the modeler engineers the relational model, it automatically concatenates the name of the entity along with the attribute (for the other entities that have Client_ID as a foreign key). So even though I'd like my foreign key to simply be Client_ID it creates Client_Client_ID. I've been googling for the better part of the day but I can't find anything related to this.
found the answer here: https://community.oracle.com/thread/4012092
rightclick the source file of your database (its this tree looking model in this window on the left of the modeler).
click settings
naming standard
templates
here you will see its format(s) for keys, constraints,etc where you can customize them
(found this right after i posted question, sorry. Swear it took me hours earlier though)

How to create a help-form in FormsBuilder?

I am required to make a form which will contain important keywords and their description, with the possibility to search between the words. It is loaded from the Help menu and it is designed to give the users detailed help informations about other components. (Just like every application's Help menu)
I only used forms to query tables, and I was wondering, what is the correct way to achieve this? Does Oracle support any feature that would auto-generate a help-form based on my 'Help' inputs from Property Palettes? or do I have to manually write data into a canvas? if so, how can I search through it?
I considered creating a table and writing help informations in it, but I don't think that is the correct way.
Oracle Forms, unfortunately, does not give you programmatic access to values stored in property palettes, so your solution will need to be custom made.
Create a table, e.g. HELP_TOPICS (keyword, help_text), add a list item that contains all the keywords; when a user selects a keyword, query the table to find the help text, and set the value on a display-only text area item on the page.

Display Distinct values in LightSwitch browse screen

i have one browse screen which is fetching value from one entity(Attached to SQL datasource),
the entity will look like the below snapshot.
So in the browse screen its coming with all row values (1,2,3 and 4) even though i removed the Role field from the screen. I want to display the distinct Emp ID, Name, Age. Please give me some suggestion.
The question tags Lightswitch 2013 and 2012 so it's not clear what the OP is using. Views handling in Lightswitch before VS2013 Update 2 can be a little more challenging (particularly around the definition of key fields) so the other possibility is to use a WCF-RIA service to reshape the data. Having a WCF-RIA service ready to go always comes in handy eventually, even if there are annoying limitations and quirks there as well.
The exact steps depend slightly on what version of VS you are using:
The canonical article by Eric Erhardt - http://blogs.msdn.com/b/lightswitch/archive/2011/04/08/how-do-i-display-a-chart-built-on-aggregated-data-eric-erhardt.aspx
An up to date version for VS2013 - http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/2226/Creating-a-WCF-RIA-Service-for-Visual-Studio-2013.aspx
Happy to help further with specific queries if you decide to go down the WCF-RIA route.
Phil
If you don't have the option of driving your Browse screen from your employee table I'd suggest creating a SQL view similar to the following: -
CREATE VIEW [dbo].[EmployeeView]
AS
SELECT DISTINCT
EmpId,
Name,
Age,
Role
FROM
dbo.YourTable
You can then attach to the view in LightSwitch and base the Browse screen on the attached view.
However, please bear in mind that you will only be able to view and not update the information as this type of view uses the DISTINCT clause.
The following blog post provides some basic details of using views in LightSwitch: -
Attaching to SQL Views

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