Write INSERT INTO VALUES(:P1_item) - sql

I want to write down what value I have in the form, in another table, but it does not work out what is wrong ?? I did a dynamic action before the create button
INSERT INTO SEC_SEALING_STATUS (NAME_OBJ,SEALING)
VALUES (:P7_NAME_OBJ,'Ні');

When invoking PL/SQL in a dynamic action, you need to send the relevant values from your browser to the database using the 'Page items to submit' attribute.
In your case, you should see P7_NAME_OBJ listed in the attribute, otherwise the value will be null, or whatever it was last time session state was updated.

remove the dinamix action
set the button to 'submit page'
create a process pl/sql with your insert code.

Related

Apex, Dynamic action, Confirm action, not picking up correct text - what am I missing?

I'm obviously missing something and hoping someone might be able to help.
I've an Interactive Grid, and a button.
When the button is pressed the dynamic action on the button has 2 steps.
Action 1 - Execute Javascript to take a value from one of the IG cells and put it into a page item.
Action 2 - Confirm Action - Are you sure you wish to delete &P10_JOB_ID.
I've made the page item, &P10_JOB_ID, visible and I can see the value has correctly been changed to the value from the IG.
I write P10_JOB_ID into a database table - I get the correct value
But the confirm message isn't picking up the correct value from P10_JOB_ID.
Namely it uses the value in P10_JOB_ID when the page starts, but then as I move around the IG pressing the button and changing the value of P10_JOB_ID, the text in the confirm message never changes.
Can anyone suggest what I might have missed, I'm baffled.
Thanks a lot
Substitutions like &P10_JOB_ID. are made when the page is rendered, not dynamically, so reflect the value at time of page load.
You will need to use Javascript to perform the conform action, something like:
apex.page.confirm ('Are you sure you wish to delete ' + $v('P10_JOB_ID') + '?', 'DELETE');
$v is an APEX Javascript function that returns the current value of a page item.
I used 'DELETE' as an example of a request value; you may want to do something different here.
Ok - having the setting of value and confirm as 2 separate actions is what causes the problem.
As per fac586
That is the expected behaviour. Static text substitutions are performed once during page show processing. They are not evaluated dynamically in the browser at runtime as values change.
Drop the second action and extend the first to display the confirm dialog using the apex.message.confirm JS API method, accessing the item value using the $v shorthand method.

Oracle APEX 5 Dynamic Action upon page load event does not work. What am i doing wrong?

The program basically aims at retrieving some fields of a record and processing and displaying that on a textbox of static content region in apex 5
My database: LCD_MONItOR table
Interface :
PLSQL code that is supposed to execute on page load event.
Declare
lcd_id LCD_Monitor.LCD__NO%TYPE;
tag LCD_Monitor.ASSET_TAG%TYPE;
pp LCD_Monitor.PURCHASE_PRICE%TYPE;
sal LCD_Monitor.SALVAGE%TYPE;
ls LCD_Monitor.LIFE_SPAN%TYPE;
accm LCD_Monitor.ACCUMULATED_DEP%TYPE;
netbook Number;
currDep Number;
Begin
select LCD__NO, ASSET_TAG, PURCHASE_PRICE,SALVAGE, LIFE_SPAN,
ACCUMULATED_DEP into lcd_id, tag, pp, sal, ls, accm from LCD_MONITOR
where LCD__No='40';
:LCD_NO:=lcd_id;
:CURR_DEP:= (pp-sal)*(1/ls);
:TOT_DEP:= (pp-sal)*(1/ls)+accm;
:NBV:=pp-(pp-sal)*(1/ls)+accm;
End;
PS: I have returned the values to the textboxes in 'Affected Elements' Section in the properties.
But when the page is loaded, no values appear in the textboxes. Any help would be appreciated.
I'm not sure if I understood correctly what exactly are you doing. If you need just fill items with data, create a before header process (in Page Designer mode, it is in Pre-rendering -> Before Header. Write your code there, it should be enough.
If you want to do it in Dynamic Action (I wouldn't recommend this way), you need to create a Dynamic Action with Event - Page Load, which will contain a True Action with properties: Action - Execute PL/SQL Code, PL/SQL Code - your code and Items to Return - LCD_NO,CURR_DEP,TOT_DEP,NBV
But make sure your items really have such names, because by default APEX creates items with names like P10_LCD_NO, where 10 (for example) is a number of the page.
Instead of directly assigning a calculated value to the textfields items, I assigned them to a variable first then assigned variables to the items i.e
Before
:CURR_DEP:= (pp-sal)*(1/ls);
:TOT_DEP:= (pp-sal)*(1/ls)+accm;
:NBV:=pp-(pp-sal)*(1/ls)+accm;
Corrected
currDep:= (pp-sal)*(1/ls);
:CURR_DEP:= currDep;
tot:= (pp-sal)*(1/ls)+accm;
:TOT_DEP:=tot;
netbook:=pp-((pp-sal)*(1/ls)+accm);
:NBV:=netbook;

Passing apex page items via button click

I'm baffled by this and hoping someone can explain this behavior to me.
I have a sample apex app here https://apex.oracle.com/pls/apex/f?p=126734:2 (admin credentials: username: guest pw: cubsarechamps).
I just want to enter a value on page 2 in text field P2_SOURCE and then click the button and be redirected to page 3 and have the value from P2_SOURCE populate P3_TARGET. I know that I need to set the value of P2_SOURCE in session and so I created a 'lose focus' dynamic action with a plsql process of null that also submits P2_SOURCE.
After I enter '123' in P2_SOURCE I tab out of the field to trigger the DA, and then I click session in my developer toolbar and I can see that the value of P2_SOURCE is indeed '123'. Then I click my button to go to page 3 but nothing is passed to P3_TARGET (unless I actually submit my page first, which I shouldn't have to do, right?).
So my question is why P2_SOURCE isn't being passed to P3_TARGET. The item is set in session state so why is &P2_SOURCE. passing a null value when there is a value set in session? Can I not use page item substitutions unless I actually submit my page? The documentation seems to indicate this is supported functionality.
My button setup is like this:
Substitution Strings are evaluated when the page is loaded and so, it is NULL in your case as the page item contains no value in the beginning. I would either use Dynamic Action with JavaScript Expression or Branch Process.

OpenErp: Update form fields

I would like to update form fields "on-fly" after button press that triggers python function.
Something like onchange that allows to return field values, but I need to do it after button press.
The situation is, to create module, that will allow to search for company information in public company register based on entered company registration ID.
The best would be, to show up some popup window with updated fields list and user has to confirm, wether to update fields values or not.
Thank you.
You can create a wizard (osv.osv_memory class) to simulate a dynamic popup window.
To populate this wizard, you can use the returned action descriptor of your python function, like this :
return {'res_model':'your.osv.memory',
'view_mode':'form',
'view_type':'form',
'target':'new',
'context':{...},
}
Thanks to your algorythm that get public company information, you just have to put you're fields values on the context, like you would do in a write() method.
Override your default_get() method of your osv_memory, which receives your context, and populate your wizard like you want.
I think a simple text fields on your wizard will be efficient to display fields updated values, and 2 buttons : cancel and OK (which will call the write method to apply fields values, always using your context).

How to create Struts Drop down List?

I m new to struts.
I Want to add drop down in web page.That drop down should contain four values. The default and first value will be (Select).
I want to persist the selected value, when that form is opened again and while submitting, if user doesn't select any value from drop down (meaning the default value is present) I want to give an alert to the user and then not to allow a submit until till the user selects an option from the dropdown.
There is one action.java, form.java, javascript file and jsp file. In action.java, I m suppose to use ArrayList to hold different drop down values. How this can be done. please help me.
<s:select list="#{'':'Select', 'key1':'Value 1', 'key2':'Value 2'}" key="selectedValue"></s:select>
or you have a list object(id, value)
<s:select key="selectedValue" list="yourlists" headerKey="" headerValue="Select" listKey="id" listValue="value"/>
Firstly, you need to show your code here. If you are interested in tutorials then I'd suggest - VaanNila, a great place to learn struts framework. (Here is a link of select tag.)