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

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.

Related

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

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.

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.

MS Access - Advancing through record groups

I have a form with a subform. The record source for the subform is as follows:
SELECT [firstID], [secondID], [AAA], [BBB], [CCC], [DDD]
FROM Table1
WHERE firstID = [Forms].[frm1].[txtfirstID];
The subform groups the records together on the basis of txtfirstID but when I advance through the record selector it goes through every record, as expected. I would like to know if there is a way to click through the groups rather than each record within each group. I'm open to any way of doing it. Perhaps filtering through VBA??
Thanks!
First, add a combo box to your form. Set the RecordSource for the combo box to a distinct list of groups, or, if you have a group lookup table, select * from tblGroups. Set the display field to be group name, and the value field to be group id.
Second, after an item is selected from the combo box, modify the RecordSource sql of the form (your query) so that it uses the current value of the combo box. The value of the combobox would be what your where clause should be looking for.
I think you can do two ways to solve this:
1.- If you related main form to subform by a field. In this case TxtFirstID of Main to FirstID of subform. It do all work when change main form and filter automatically on subform
2.- You can do and event OnChange form TxtFirstID on main form.
Sub TxtFirstID_Change()
Me.subfrmName.Form.RecordSource = "Select * from table1 where firstID=" & Me.TxtFirstID 'change the record source for the SubForm
me.subfrmName.Form.Requery 'Force Access to refresh the Record Source
end sub

APEX 4.0 - How to load items when using select

I have a question about APEX, I have the problem that when I try to select a value from a selectbox, no value shows in the other items. What I have tried to do is loading data from the database to the items when I select a code from the selectbox with PL/SQL. How do I do this? Selecting a code from a selectbox and filling all the other items?
Vid
Ok if i understand you right you need a List of Values.
If you create this shared Object. Use a dynamic list.
There you have a dialog you can put a PL/SQL or SQL Code snippet into.
You must return a 2 column list. The first Column is the field name in you later select box and the second is you reference.

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)