I have two cascading popup LOVs on my page P2_LOV1 and P2_LOV2
P2_LOV2 gets populated based on a query and the value selected in P2_LOV1. What I want is if there is only one value populated in P2_LOV2, set it as a selected value. How can I do that?
You could create an on change dynamic action with a client side condition of
$('#P2_LOV2 option').length == 2
The length may be 1 or 2, depending on if you have a null option.
If true, set the value. Again, the numeric may be 1 or 0, depending on null selection.
('#P2_LOV2').prop('selectedIndex', 1)
But if you don't have a null selection, this would automatically set to first value, right?
Related
I'm trying to create lov in which once the machine is started it should not show in popup lov after submit.
Popup lov sql is as below:
select machineid,machinenm from machinemaster where idlemachine = 'Y';
but the issue is once machine is status change and this query not finding result for the perticular machineid so in lov it shows blank.
Please suggest any workaroud.
First of all, query you posted looks wrong. Generally speaking, list of values' query returns two values in the following order:
display value
return value
We usually display names and return IDs, which means that you'd probably want to use
select machinenm as display_value,
machineid as return_value
from machinemaster
where idlemachine = 'Y';
the issue is once machine is status change ...
How is that statement reflected in query you posted? There's no "status" column nor "change" status itself; where clause says where idlemachine = 'Y' - no status, no "change".
... and this query not finding result for the perticular machineid so in lov it shows blank
I believe that you should set the Display extra values property ON. Help says:
An item may have a session state value which does not occur in the given list of values definition. Select whether this list of values displays this extra session state value. If you choose to not display this extra session state value and there is no matching value in the list of values definition, the first value in the list of values is the selected and displayed value.
If you're seeing the NULL value, it means that you actually set
display extra values to OFF
display null value to ON
I have a shuttle list that, depending on the selection of a previous form, may have between one and seven items. Is there any way for me to automatically move the entry to the right hand pane if there is only a single selection, just for the sake of long term optimization and user friendliness?
You can add a default Value to your shuttle item
SELECT YOUR_COLUMN_ID
FROM T0000_YOUR_TABLE
WHERE FILTER_COLUMN_ID = :P_FILTER_ITEM_PREV_FORM
GROUP BY YOUR_COLUMN_ID
HAVING COUNT(*) = 1
If there are more than 1 entries for your filter item the statement will return nothing, if there is exactly 1 entry the entry will be returned and set for your shuttle item
I like sim0n's answer. But here's another that uses JavaScript (you can choose which is best for your use case).
Create a Dynamic Action. Set Name to Page loaded and Event to Page Load.
Select the Action created by default. Set Action to Execute JavaScript Code, then enter the following code in Code.
var itemId = 'P1_ITEM_NAME';
var $opts = $('#' + itemId + ' select:eq(0) > option');
if ($opts.length === 1) {
$s(itemId, $opts.val());
}
Don't forget to change the name of the item to match the one on your page.
When the page loads, the JavaScript will check to see how many options are in the select element on the left. If there's just one, it will set the value of the item using the value to the value of the single option.
This is a VERY basic question. Sorry for not providing any code I have NO IDEA how to even start tackling the problem
I have lets say two fields... One is a date selector field and the other a regular text field. What I want is when I select a date (or type a date), the value comes in the second field... Just that...
I'm on APEX 5.1.4
Since you have stated that the second item is a text field, you could do this with the help of a dynamic action that sets the value of the second item when there is a change in the value of the first item ( date field).
The following would be the steps, if you are using component view:
Create Dynamic Action
When
Event : Change
Selection : Item(s)
Item : First Page Item
Condition : is not null
True Action
Action : Set Value
Fire on Page Load: No
Set Type: You can choose how you want to set the value of the second item on the page.
If you have the flexibility to change the second item to be a select list and you have a list of values that goes with a date, you could do this much simpler, with a Cascading LOV
On Second Item's - Under List of Values section
Cascading LOV Parent Item(s) : First Item
Page Items to Submit: First Item
List of Values definition: Here you can define the query.
Hope this helps.
There are a few different ways to do this, probably the easiest way is as follows.
Assume your two items are P1_ITEM1 and P1_ITEM2.
Create a dynamic action which fires on change of item P1_ITEM1.
The true action of this should be action:set value, set type:PL/SQL Expression, item::P1_ITEM2, items to submit P1_ITEM1.
I have an Item select list Workspace value (a,b,c) in page 1
I am selecting some value ex:'a' in item page 1 and stored that in table.
Now I want to display the selected value in page 1 to should display as default item value of another item in another page 2 as default value.
Is this is possible please let me know how to proceed.
The default value for an item can be taken from another item by setting the Default Type to PL/SQL Expression. You can refer to another item on the page using bind variable syntax, e.g. :P2_WORKSPACE.
In the navigation from page 1 to page 2, you would need to copy P1_WORKSPACE into P2_WORKSPACE (this is preferable to referring directly to the page 1 item).
I have the web service, which has method State() that returning the List. where i want to design the infopath form that having the repeating table. in repeating table one of column should have the drop down list.
I want to populate this List in the drop down list (states). Each selected instance in the dropdown must be unique means when i would select state A for row 1 then in other row there must be validation that should not select the state A again.
in short avoid the duplicate selection.
Include a section with a validation message under each dropdown. Select the section Properties > Display > Conditional formatting.
Set the condition as dropdown2_field is equal to dropdown1_field.
(Need to add similar multiple conditions for 3rd,4th successive dropdown boxes.)
and select Hide this control check box.
If the user selects the same state in dropdown2 the validation message is shown.