What for using KEY-LISTVAL in item trigger? - oracle12c

I had been working on oracle form 6i for long time and now convert to 12c.
I used not to create item trigger KEY-LISTVAL to handle LOV pop up because the LOV works perfectly as long as the LOV attached to a correct item.
However, some programmers likes to create KEY-LISTVAL to each items which has LOV attached. In the item trigger writes:
list_values;
LOV seems work no different even without this code. Why using this trigger?
Many thanks.

We use it most of the time to create an if statement in the trigger.
If the item is empty select the value with an lov (list_values).
If the item is not empty open another form with the details of the value you selected.

If the KEY-LISTVAL trigger has its "Fire in Enter-Query Mode" property set to "No", this could allow an LOV to be used in data entry mode, but not in query mode.

Related

Access Update table with selected value from a combobox in form

good morning,
I'm breaking it up with a simple thing
I have a form access that contains a combobox called cboHora and I want to simply update my table (tbEntry) with the value selected in the combobox
Call my query with vba : DoCmd.OpenQuery "Consulta1"
But even fill in the combobox before running the query, the following error appears:
My latest attempt
Can you help me?
You can't use Me. to reference a form object in a query, you have to use the
[forms]![YourFromName]![YourControlName]
syntax. The expression builder will get you there if you examine the objects.
The form must be open in normal view (not design view) when the query is run.

Update chart after changing a field in an APEX form

How do I cause APEX to refresh a chart (graph) after I change the value in a text box/select list/etc that is used as a parameter in the chart's pl/sql statement?
I'd like it to look as professional as possible and minimize the portion of the page that must be refreshed (i.e., "ajax-like", which is the standard in 2018).
Create a dynamic action on the text box/select list/etc that is changed with event "change"
Create a true action and select pl/sql and write
Begin
null;
end;
In page items to submit select your items
Create a second true action after the first and select Refresh. Then select region as affected element and select your chart. Remember that the option 'Fire on initialization' must be set to NO
See Approach B, below, for the optimal solution.
Approach A
The simplest option (that is less professional) is to modify every text box/select list/etc of interest to submit the page when the value of the text box/select list/etc changes. As an example, for the select list, go to its settings->page action on selection and change the setting to submit page.
There are two main downsides to that approach:
Most of the page will refresh, which is jarring to your user, and
If you're using a plugin, or the type of item that you're using doesn't support that approach, then you're out of luck.
Approach B
A more complex solution that yields a more professional result follows. This solution involves dynamic actions, which I will probably not fully explain here. However, the information should be enough for the user to figure it out.
Let us suppose that you have two things: (1) a select list whose value is used as a parameter in a (2) chart's sql source statement.
To get the chart to update every time you make a new choice via the select list, you need to:
Create a dynamic action for the select list of interest. You do this by clicking on the select list, going to the dynamic action tab (the lightning bolt); right-click on the item; click select dynamic action; give it a name and set the event to change and make the selection type an item and set the item to the name of the select list you're watching.
Create a true action for that dynamic action that executes pl/sql code (you can do this by modifying the show action that was created by default in 1.). Set the pl/sql code to null;. Then under items to submit, specify the name of the select list of interest.
Create a second true action that refreshes the region that contains the chart.
You'll need to make sure that the sequence assigned to 2. is a smaller number than the sequence assigned to 3.. This should happen by default, but it's an area you can get tripped up.
Inapplicable Approach C
In Apex 5.something, they added a feature called Cascading List of Values. This feature allows you to specify that one item depends on another item for its values. For example, if you have a select list that allows the user to choose a department, and then you have a second select list that allows you to choose an employee from the chosen department (which presumably obtains its values from a query involving the value chosen in the first select list), you can tell APEX to refresh the second select list whenever you update the first.
You do this by editing the second select list. Under its settings goto list of values->cascading LOV parent item(s). Add the first select list as a "reverse" dependent (aka, "parent"). This will ensure that any time the first select list is updated, the second select list is also updated.
For better or for worse, charts do not have the cascading LOV parent item(s) setting. Thus, this solution does not apply to this question.

Oracle Forms 10g LOV not showing up second time

I have created Oracle Forms 10g form and want to display LOV by pressing the button. On When-Button-Pressed trigger I have:
go_item('MyBlock.Item1');
do_key('LIST_VALUES');
LOV has 6 columns and 2 of them are bound to 2 items: MyBlock.Item1 and MyBlock.Item2. When I press the button LOV appears and I can make a choice. LOV inserts data into MyBlock.Item1 and MyBlock.Item2 and everything is fine.
But if I want to make another choice and press the button again LOV doesn't appear. I don't know what is the problem.
Button and both items are in the same data block, I set Update Allowed and Required to No for both items and Mouse Navigate to No for button (I saw this on few forums).
Try putting synchronize command between these two lines:
go_item('MyBlock.Item1');
Synchronize;
do_key('LIST_VALUES');
I finally found solution (using oracle's OTN discussion).
The problem was stored procedure I call after first popping up of LOV. First time, after I chose a value I delete record of another block using stored procedure. In that procedure I set values of columns MyBlock.Item1 and MyBlock.Item2 are connected with. But on the form the old values remains on items. I removed update this two columns in procedure and it works now. But I needed this two fields to be updated to null automatically.
The solution is that I first change values of those items on form and then I call stored procedure. It works now.

Access comboxbox selection needs to change value in label control

On a form, I have a combobox, with the RowSource coming from a query (specifically, a calculated field in the query). When the user makes a selection, I want to update a label on the same form with a different column from that same query, but of course associated to the selection.
I'm fine with VBA and writing queries and whatnot, but I am not very familiar with Access forms.
By the way, I tried searching for an answer to this, but it was quite difficult because I don't know what this thing is really called that I am trying to do. A good link to a site explaining this would be perfectly fine (no need to write a bunch of stuff here if it already exists elsewhere).
In the After Update event of my combo box, cboUserID, I can set a label control, lblFoo, to the value of the second column in the selected row of the combo.
Me.lblFoo.Caption = Me.cboUserID.Column(1)
If your combo box is bound to a field in the form's record source, you may want to do that same operation from the form's On Current event also.
You can use the column property to refer to anything other than the bound column of a combo.
Rowsource: SELECT ID, SName, FName FROM Table
Me.MyCombo.Column(2)
This would return FName.
-- http://msdn.microsoft.com/en-us/library/aa224084(v=office.11).aspx
Me.MyLabel.Caption = Me.MyCombo.Column(2)

How do I gain Control of a row in Tabular Layout in Oracle

This might be simple but I am new to Oracle. I am using Oracle 10g and have a form that lists our information from a linked table in a tabular Layout. The last column of data is a "list Item" item type that has the Element list of Enabled (T) and Disabled (F).
What I need is when a user changes this dropdown, to disabled, I want ONLY that row to have some of the columns be disabled and not the entire column.
This is also assuming on load of the form, it will disable and enable rows of data depending on what values are being pulled from the EnabledDisabled column in the database.
Thanks for the help!
Option 1: use the ENABLED item property.
Unfortunately Oracle Forms does not allow changing the ENABLED property of an item at the item instance level.
What you can do, however, is enable or disable the whole item when the user enters a record - use the WHEN-NEW-RECORD-INSTANCE trigger - depending on the value of the current record's value for the list item, the trigger would set the ENABLED property to PROPERTY_TRUE or PROPERTY_FALSE.
Of course, your list item would also have the same code in its WHEN-LIST-CHANGED trigger.
The downside to this approach is that the whole column will "look" disabled to the user, and they will not be able to select a different record using those disabled items.
Option 2: use the INSERT_ALLOWED and UPDATE_ALLOWED properties.
You can set these properties at the item instance level using SET_ITEM_INSTANCE_PROPERTY. You would set them in the block's POST-QUERY trigger, as well as in the list item's WHEN-LIST-CHANGED trigger.
This would not, however, change how the items look on the screen. To solve this, you could also set a visual attribute at the item instance level (e.g. change the items to use a dark gray background or something).
More comments.