Oracle Apex: how to exclude a selected PopUp LOV row from its Query and refresh it dynamiclly - popup

i had an IG, it has a PopUp LOV column to select value, the LOV Query is in Shared Component. is it possible if user select '01-My First Row' from LOV this will not available in next row or disabled to select and similar for other selected values? if yes, how it can done? filtering LOV Query on runtime refrencing selected value(s) in IG or anything else? help needed.

To be able to decide if a value from LOV is selected before it is submitted to the server-side (before saving the IG in that case), you need to handle that using client-side code(javascript).
As an idea, you can create a dynamic action that will execute a Javascript code on LOV value selection.
In that Javascript code, use
var widget = apex.region('yourgridID').widget();
var grid = widget.interactiveGrid('getViews', 'grid');
var model = grid.model;
model.forEach(function(r) {
var record = r;
console.log(record);
})
Then you can observe the record on your browser's console to see the column value when an item of LOV is selected.
Then you would need to use JQUERY for disabling the LOV list values.

Related

I am unable to use HIDDEN Item in sql query... like fetching data in LOV where hidden Item is used in where clause

It's a very simple query in select list:
select description,code
from table
where flag=:P18_FLAG;
It works fine if :P18_FLAG is a TEXT ITEM, but when I change :P18_FLAG to a hidden item (Value Protected=NO), it stop working.
You should use the cascading LOV Parent Item(s) feature and submit the item.

Display Only Selected Rows in sap.m.Table

I have a table created by using sap.m.Table and a filter in the headerToolbar.
When the user clicks on the filter button, a list, which contains the key field of the table, should display with all available rows.
When the user selects and clicks on OK in the dialog, only
those rows should be displayed in the table.
The Dialog has list of values along with OK and CANCEL buttons.
I am trying to achieve it by changing the model of the table after user selection but could not get it. Can someone please let me know where I went wrong and if any other better way to do it?
var list = new sap.ui.getCore().byId("ls2");
var sel = list.getSelectedItems();
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oModel);
var oElement = sap.ui.getCore().getElementById("table1");
oElement.setModel(oModel);`
After OK, the table should display values which are selected from the list.
You are trying to set the columns that are shown by the Table, but instead you are changing the filters you want to manage, or even the oData model that feeds the table. That's wrong.
Use the property useTablePersonalisation="true" in your table.
It will appear a "control" button above your table. Click it and go to the tab "Columns" (it should be default). Then choose the columns you want to be displayed.
Tell me if it is enough for you.

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.

What for using KEY-LISTVAL in item trigger?

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.

web2py SQLFORM.factory defaults not updating

I have an SQLFORM.factory on a page that I use to(among other things) update a particular field in a table. That field is a drop down table I made like so
Field('visibility',requires=IS_IN_SET(['everyone','subscribers','friends','nobody']))
So the field in the SQLFORM.factory looks the same. The difference is that I want the default in the SQLFORM.factory to be the current value of that field in a particular table. by making a default. I do a query on the desired entry on the table, select that field, and that becomes my default, the selected option. Perfect the first time you load it up.
I do the update after the form accepts like so and the update works functionally:
if subForm.accepts(request,session,dbio=True):
if myForm.vars.visible != theDefault:
db(row).update(visibility = subForm.vars.visibility)
If you submit the page the selected option is not the current value of that field in the table, it's always the one it was previous. If I look at my database admin the table updated fine but I could not fetch the right option to select as my default. If my default was 'everyone' and then I select and submit 'friends' then the selected when the page reload after the submit is still 'everyone' If I then select and submit 'nobody', after the refresh it is 'friends'.
If it helps, I am displaying the view this SQLFORM.factory is in in and iFrame as part of a bigger page.
After many hours, here's how you do it(sorta hackey but it works)
#This is a kludge to get the right default visibility selected
if request.vars.visible == None:
visibleDefault = theDefault
else:
visibleDefault = request.vars.visible
form = SQLFORM.factory(
FIELD(Field('visible',requires=IS_IN_SET(['everyone','subscribers','friends','nobody'],zero=None),default=visibleDefault),
table_name='table')
if form.accepts(request,session,dbio=True):
if form.vars.visible != theDefault:
db(row).update(visibility = form.vars.visible)