Radio button validation using PL/SQL - oracle

I am new to Apex Oracle and PL/SQL, trying to validate radio input from the user
Declare
begin
if :R_button = 'NO' then
:Page_comment != NULL;
end if;
end;
There are three options available, YES, NO, and N/A. if the user selects No then it should prompt a comment. how best should i achieve this?

Here's one option.
you already have a radio button (R_BUTTON)
let's suppose that return values are
Y for "Yes"
N for "No"
A for "N/A"
create a dynamic action on the radio button
When:
Event = change
Selection type = item
Item = R_BUTTON
Client-side condition - set it so that DA fires when radio button value is N/A
Type: Item = Value
Item: R_BUTTON
Value = A
True action
Action = execute JavaScript code
Code = apex.message.showPageSuccess("N/A has been chosen");
Affected elements: type = item
item = R_BUTTON
That's all. Run the page and test how it works.
This test has been made on current apex.oracle.com version (19.2):

Related

Add a validation in dynamic action in apex

I am creating a desk reservation application in apex, I have a page to select the date and time for a specific desk and I have an apply button to run the plsql code to insert the data in the reservation table in the db. Now, I want to validate if for the selected desk there is not any other reservation in the same date and in the same time range, then the reservation will be booked.I have created a hidden page item as a flag, and then 2 true actions before the action of inserting data:
first true action : Execute Server Side code
BEGIN
:P6_DUPLICATE_FLAG := 'N';
FOR ITEM in (SELECT TIME_TO FROM WPB_RESERVATIONS WHERE RESERVATION_DATE =
:P6_RESERVATION_DATE
AND LOC_ID = :P6_LOC_ID
AND ROOM_ID = :P6_ROOM_ID
AND WORKPLACE_ID =
:P6_WORKPLACE_ID)
LOOP
IF ITEM.TIME_TO > :P6_TIME_FROM THEN
:P6_DUPLICATE_FLAG := 'Y' ;
END IF;
END LOOP;
END;
and the second true action :Execute java-script code
// First clear the errors
apex.message.clearErrors();
var errorFlag= $v('P6_DUPLICATE_FLAG');
if(errorFlag == 'Y') {
// Now show new errors
apex.message.showErrors([
{
type: "error",
location: [ "page", "inline" ],
message: "There is a reservation for this desk in selected time!",
unsafe: false
}
]);
//To stop the further actions from firing
apex.da.cancelEvent.call(this);
}
the problem is I get different errors when pressing the apply buttun even the date is correct and I am sure it is not duplicated.
before adding this validation everything worked ok.
Am I doing something wrong?
IS there any other way to do this validation?

Select an item by name instead of id in VBS

I have recorded a script on SAP that runs on CITRIX. Everything worked fine until some items were added to the window that the right item was selected to filter the columns. I guess the reason is that the proper item (e.g. MATART in the shown picture) moved down and it was not the same row, order etc.
I was wondering whether there is a way to select the item by its name instead of id?
This is the part of the script with the line that selects the items:
session.findById("wnd[0]/tbar[0]/okcd").text = "/nzm082"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/tbar[1]/btn[33]").press
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").currentCellRow = 1
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "1"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").clickCurrentCell
session.findById("wnd[0]/tbar[1]/btn[45]").press
You could test the following.
for example:
...
session.findById("wnd[0]/tbar[1]/btn[33]").press
set myLayout = session.findById("wnd[1]/usr/cntlGRID/shellcont/shell")
Rows = myLayout.RowCount
For i = 0 to Rows - 1
myVariant = session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").getCellValue (i, "VARIANT")
if myVariant = "MTART" then
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").currentCellRow = i
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").clickCurrentCell
Exit For
end if
next
session.findById("wnd[0]/tbar[1]/btn[45]").press
...
Regards, ScriptMan

Showing "select list" under certain circumstances

I want to implement an ID list which should only be visible under certain circumstances.
As you can see in the image above, I've got a Radio Group and want the ID list just to appear when the user is selecting 'YES' in the group.
Is there a way to do so?
Greetings and thanks for your answers!
Use a Dynamic Action.
Event = Change
Selection Type = Item(s)
Item(s) = (your "Merge" radio item)
Condition = equal to
Value = YES
True Action = Show
Selection Type = Item(s)
Item(s) = (your "Id List" item)
Fire On Page Load = Yes
False Action = Hide
Selection Type = Item(s)
Item(s) = (your "Id List" item)
Fire On Page Load = Yes

How to reference a page-item from a tab

I have Oracle APEX 5.0.3.
I want to hide/show a tab with a condition referencing a page-item:
:P1_XXX = 1
Is it possible, that the page-items are not visible for the tab-condition?
The tab is not shown with condition
:P1_XXX = 1
and with condition
:P1_XXX = 0
The content of P1_XXX is 1.
Thank you very much!!
oradev2015
Yes you can still include an item in a condition even if it is hidden. Have you tried the PL/SQL function body type of condition? If not then try it. then in the PL/SQL section of your condition, enter the following codes:
IF :P1_XXX = 1 OR :P1_XXX = 0 THEN
RETURN FALSE;
ELSE
RETURN TRUE;
END IF;

How to check the selected Items

Using VB6
In the Form, i am having 2 list box name as lstDivison, lstDepartment
Code
For I = 0 To lstDivision.ListCount - 1
If lstDivision.Selected(I) = True Then
Filter = ""
Filter = lstDivision.List(I)
Divison
Else
ViewAll
End If
Next
For I = 0 To lstDepartment.ListCount - 1
If lstDepartment.Selected(I) = True Then
Filter = ""
Filter = lstDepartment.List(I)
Department
Else
ViewAll
End If
Next
Above code is working, but i want to know which listbox value is selected.
Conditon
If lstDivison list item is selected then it should not check the lstDepartment, if lstDepartment list item is selected then it should not check the lstDivison...
Code like this...
If lstDivison.selected = true then
some code
ElseIf lstDeartment.Selected = true then
some code
Else
Some code
End If
How to do this.
Need VB6 Code Help
One way to solve this is to ensure that only one of the listbox controls has a selected value at each time, by letting the listboxes clear the selection from the other listbox when selected. This makes it somewhat clearer to the user what values to expect from the filter, since there will only be selected values in one listbox at a time.
To do this, you can add this code:
private sub lstDepartment_Click()
For I = 0 to lstDivision.ListCount - 1
lstDivision.Selected(I) = False
Next
End Sub
private sub lstDivision_Click()
For I = 0 to lstDepartment.ListCount - 1
lstDepartment.Selected(I) = False
Next
End Sub
After this, your current code will work.

Resources