ORACLE APEX - Set up a Button to populate a textfield - oracle

I have a button which I would like to take the Input text field called P7_INPUT and Divide (/) it by 2000 and pop it into the P7_OUTPUT
Users enters say 3000 into P7_INPUT field and pressed the Button then in the P7_OUTPUT is will show the value of 1.5

Right-click on the :P7_INPUT and select Create Dynamic Action. Set the following properties:
Event: Key Release
Selection Type: Items(s)
Item: P7_INPUT
Right-click the dynamic action and select either Create TRUE Action. Set the following properties:
Action: Set Value
Set Type: PL/SQL expression
PL/SQL expression : NVL(:P7_INPUT,0) / 2000
Items to Submit: P7_INPUT
Affected Elements > Selection Type: Item(s)
Affected Elements > Item(s): P7_OUTPUT

You don't even need a button.
create P7_INPUT as a text item; set its "Submit when enter pressed" property to YES
create P7_OUTPUT
create a process which will contain a PL/SQL code:
:P7_OUTPUT := :P7_INPUT / 2000;
That's all; when you enter e.g. 3000 into the input item and press enter, process will do the calculation and display the result in the output item.
If it must be with a button, create it and let it submit the page. Process will look the same, you'd just put P7_BUTTON into process' "Server side condition's" "When button pressed" property.

Since you require the action to occur dynamically when the user clicks a button, I would create a Dynamic Action on button click with a Set Value action for P7_OUTPUT set to a JavaScript expression:
parseFloat($v("P7_INPUT)) / 2000
This avoids a server round-trip.

Related

Set page item value to show in DA confirm message

I'm using Oracle Apex Version: 20.1
I have a page item (:P303_ADJUSTAMOUNT) that has a default value that's set via sql query. When the user presses the submit button, I have a DA confirm action that shows a popup window to confirm the amount the user is trying to adjust. This works if the user doesn't change the page item value after initialization, as the modal window displays the value that was retrieved from the sql query (the item's default value).
I created another DA on the page item itself to set the value of the page item on the "Lose Focus" event (Set Value --> PL/SQL). I want the DA to set the item's value to whatever the user has entered at the time. Yet when my confirmation message pops up, the page item is still set to the default value and the value I entered disappears. Where am I going wrong here?
Set Value Dynamic Action
Confirmation Message
Update on 04/26/2022:
I finally got my message to be able to display the page item's value and not the page item's session state value. But I have a feeling I'm doing a little extra work to get the desired result.
New code for dynamic action
Action: Execute JavaScript Code
Code:
var msg;
var amt;
msg = "Are you sure you want to insert a singleton for $"
amt = apex.item( "P303_ADJUSTAMOUNT" ).getValue();
apex.message.confirm(msg.concat(amt,"?"), function( okPressed ) {
if( okPressed ) {
apex.submit('ADJUST');
}
});
Desired Result: Update Confirmation Message

Oracle Apex button click it will open new window

Oracle Apex 5.1, once click the button it will open new window its possible?, any one please provide the sample code
Use the below code
javascript:window.open('f?p=&APP_ID.:1:&SESSION.:::1:P1_ID:'+$v("P844_ID")+','_blank');
In dynamic action : create an on click DA that executes JS
var rowid= this.triggeringElement.id;
vUrl = apex.util.makeApplicationUrl({
//appId: $v("pFlowId"), // default is $v("pFlowId") - current app
pageId:10, // default is $v("pFlowStepId") - current page
//session: $v( "pInstance" ), // default is $v("pInstance") - current session
// request: 'TEST_REQUEST', // default is $v("pRequest") - current request
//debug: 'YES', // default is $v("pdebug") - debug YES/NO
itemNames:['P10_SHP_APPLICATIONS_TBL_ROWID'],
// item names array (no value by default)
itemValues:[rowid] // item values array (no value by default)
//printerFriendly: 'YES' // no value by default
});//console.log(vUrl);
window.open(vUrl);
LMGTFY - Did you try the following
APEX open URL in new window
javascript:window.open('f?p=&APP_ID.:3002:&SESSION.:::3002:P3002_CPY_ID,P3002_RPM_ID,P3002_ACM_ID, P3002_FORMAT,P3002_REPORT_PAGE_NO:'+$v("P1977_CPY_ID")+','+$v("P1977_RPM_ID")+','+$v("P1977_ACM_ID")+',VIEW,1977','_blank');
Use the above code
Click the button and create the dynamic action and select Execute Js and paste the query.. pass the parameter and page no everything.. then try
Flow below step
Go to Button
Go to button Behavior
Action : Redirect to URL
javascript:window.open('f?p=&APP_ID.:1:&SESSION.::NO:1:P1_PID:'+$v("P2_PID")+'');

E4 RCP How to set selection of ToolBarItem that contains Radio Buttons

In Eclipse E4 (Luna), using the application model to create parts, handlers, commands, handled menu items etc, (these are not created programatically). I have a toolbar. This contains a sub-Menu item called "Filter" that contains another sub-menu of two filters. The two filters are two Handled Menu Items which are set up as "Radio" Buttons.
When I select the appropriate in the UI of my running app from the selection, the Radio button switches just fine to the selected Item. However I would like this selection to update (deselecting one Radio button and selecting the appropriate radio button of the handled menu item) when my ViewPart changes through other UI selection. Currently my ViewPart updates, but the Radio buttons are on the same previous selection through the UI.
Is there a way in which I get access both Handled Menu Item's IDs and set the selection (one to false, the other to true) when the viewer is updated.
Image of design is attached below:
Hierarchy of the application model is as follows:
Thanks in advance,
Marv
You can use the model service to find menu items. Use something like:
#Inject
EModelService modelService;
#Inject
MApplication app;
List<MMenuItem> items = modelService.findElements(app, "menu item id", MMenuItem.class, Collections.emptyList(), EModelService.IN_MAIN_MENU);
Once you have the MMenuItem you can call the setSelected(boolean) method to change the selection.
To find a menu item which is in a Part menu use:
modelService.findElements(app, "menu item id", MMenuItem.class, Collections.emptyList(), EModelService.IN_PART);
(IN_PART argument instead of IN_MAIN_MENU).
You could also specify the MPart rather than the Application as the first argument to findElements which may speed up the search.
For menus as a child of a Tool Bar Item it appears that the model services cannot find these directly. However you can find the Tool Bar Item and look at the menu yourself:
List<MToolItem> items = modelService.findElements(app, "tool bar item id", MToolItem.class, Collections.emptyList(), EModelService.IN_PART);
MToolItem item = items.get(0);
MMenu menu = item.getMenu();
List<MMenuElement> children = menu.getChildren();
... search menu elements
I solved this by starting with MPart PartID and drilling down to the HandledMenuItems on which I wanted to set the Radio Button selections, then setting the selection property for each individual HandledMenuItem.
This can probably be refactored to be more concise, but I've left the code with each step to have the solution easier to read.
BTW, in every instance / combination of the EModelService methods, the list returned a size of 0. So I'm not certain if that will work for what I'm trying to achieve. The following does work, although I'm not certain it is the most efficient means.
I hope this helps others.
// Get view part
MPart viewPart = _partService.findPart("part_id");
// get list of all menu items from the Part
List<MMenu> viewPartMenu = viewPart.getMenus();
// Get list of ViewMenus from viewPartMenu there is only one View Menu so it will be index 0
MMenu viewMenu = viewPartMenu .get(0);
// Get list of MMenuElements from the viewMenu - the children in the view menu
List<MMenuElement> viewMenuElements = viewMenu.getChildren();
// This gets me to the 2 HandledMenuItems
// Upper Most HandledMenuItem Radio Button is at viewMenuElements index 0. This is cast to MHandledMenuItem
MHandledMenuItem upperHandledMenuItem = (MHandledMenuItem) viewMenuElements.get(0);
// Set Selection
upperHandledMenuItem.setSelected(false);
// Lower Most HandledMenuItem Radio Button is at viewMenuElements index 1. This is cast to MHandledMenuItem
MHandledMenuItem lowerHandledMenuItem = (MHandledMenuItem) viewMenuElements.get(1);
// Set selection
lowerHandledMenuItem.setSelected(true);

Delete Record VB2010 w/ TableAdapter

This shouldn't be this hard... But it's late.
I am working on a simple form, and trying to delete a record from a connected DataSource while using a TableAdapter. Here is the SQL for the TableAdapter;
DELETE FROM Main WHERE (ID = ?) AND (tbl_Job_Name = ?)
Main is the table name, only two fields.
I am populating a ComboBox with this data, and I am using a Button to call the Delete() action like this;
Private Sub btnDeleteJob_Click(sender As Object, e As System.EventArgs) Handles btnDeleteJob.Click
Dim deleteJobAdapter As New DCGDataSetTableAdapters.MainTableAdapter
deleteJobAdapter.DeleteQuery(ComboBox2.SelectedIndex, ComboBox2.SelectedText)
End Sub
When I break the code I can see the ID value, but the SelectedText field is blank, and of course when it runs through the record is not deleted. I would ideally like to just pass the ID of the selected record in the ComboBox to delete the record. What am I missing?
Try,
deleteJobAdapter.DeleteQuery(ComboBox2.SelectedIndex, ComboBox2.Text)
SelectedText property:
Gets or sets the text that is selected in the editable portion of a ComboBox.
Text property:
Gets or sets the text associated with this control.
You can use the SelectedText property to retrieve or change the currently selected text in a ComboBox control. However, you should be aware that the selection can change automatically because of user interaction. For example, if you retrieve the SelectedText value in a button Click event handler, the value will be an empty string. This is because the selection is automatically cleared when the input focus moves from the combo box to the button.
When the combo box loses focus, the selection point moves to the beginning of the text and any selected text becomes unselected. In this case, getting the SelectedText property retrieves an empty string, and setting the SelectedText property adds the specified value to the beginning of the text.
When I enter the code;
deleteJobAdapter.DeleteQuery(ComboBox2.SelectedIndex, ComboBox2.Text)
My break point shows the correct text from the record, but I did notice that the ID value is incorrect, the SelectedIndex returns a sequential number of the record itself, starting with "0". So it looks like SelectedIndex does not return the actual ID value...
And back to the original issue, the record selected is still not deleted.
This is what I ended up using;
Dim delJobID = ComboBox2.SelectedValue
Dim delJobRowAdpt As New DCGDataSetTableAdapters.MainTableAdapter
Dim delJobRow As DCGDataSet.MainRow
Dim intDelete As Integer
delJobRow = DCGDataSet.Main.FindByID(delJobID)
delJobRow.Delete()

Kendo grid group header customize to show the value and more

I have a Kendo grid that is groupable. The initial display needs to show all data items with no groupings displayed, i.e no 'group' and 'groupHeaderTemplate' are defined.
The grid contains a column (Suspension) where the value displayed is a translated dataitem value, i.e. if value > 10, display '*'.
When the user drags the Suspension column header cell to group, how can you customize the group header to show the value that it is grouping on plus the display 'value', i.e. 10-* ?
Do you mean on the button to turn off the group, or the group header text above each group in the grid ?
If the button to remove the grouping, I think you are stuck doing that manually.
If you mean the text above each group, columns have a groupHeaderTemplate property you can set.
groupHeaderTemplate: "Grouped By Name: #= value #"
See sample http://jsbin.com/IbITaT/2/edit

Resources