If-statement in application-process
Hi,
First I will tell you which APEX I am using: 3.0.1
Ok, I have got a form where there are 4 fields:
P13_ACCTNO (Popup LOV (fetches first rowset)),
P13_LOCATION_NAME(Text Field (Disabled, saves state)),
P13_COMP_ACCTNO( Popup LOV (fetches first rowset)),
P13_LOCATION(Text Field (Disabled, saves state))
In my table, the company is always filled in, no null values (but it is not the PK, this is the acctno). But location may be null.
When I select a location (popup will only show fields which are filled in), then the other fields are filled in as well. So the Location (number) and the acctno is the same.
Now, when I select a comp_acctno, the rest of the fields are filled in automatically. But the Location (number) will remain from the first select, although no location might be there.
So I have got 2 javascript codes on the page and 2 applicationprocesses and 1 application item.
I would like to have an if-statement in my application-process (instead of " HTP.prn ('<item id="P13_LOCATION">' || v_null || '</item>');", something like:
if :p13_location_name is null then
:p13_location = ' ';
end if;
But I don't know how to put this into the following code, because it is a mixture, which I don't understand completely.
DECLARE
v_acctno primemines.acctno%type;
v_company primemines.company%type;
v_mineloc primemines.mineloc%type;
v_commodity primemines.commodity1%type;
v_null varchar2(5);
CURSOR cur_c
IS
SELECT acctno, mineloc, company, commodity1
FROM primemines
WHERE acctno = TO_NUMBER (:temporary_application_item);
BEGIN
FOR c IN cur_c
LOOP
v_acctno := c.acctno;
v_company := c.company;
v_mineloc := c.mineloc;
v_commodity :=c.commodity1;
END LOOP;
v_null := '';
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<body>');
HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
HTP.prn ('<item id="P13_ACCTNO">' || v_company || '</item>');
HTP.prn ('<item id="P13_LOCATION_NAME">' || v_MINELOC || '</item>');
HTP.prn ('<item id="P13_COMMODITY">' || v_commodity || '</item>');
HTP.prn ('<item id="P13_LOCATION">' || v_null || '</item>');
HTP.prn ('</body>');
and also I have discovered that the automatically filling of the fields is only working sometimes (i don't know whether it depends on the company I select). Any ideas, why this is happening?
could somebody help me with the code please?
Thanks,
regards,
Denise
Hi,
@Chad: thanks for the code, I think it works (UPDATE: no, it does not work :-( )
now i am just left with the other problem that it works only sometimes
@user512746: yes, i guess you have understood correctly. I have changed the items P13_ACCTNO source used to "always replace" and taken out the default value, which I had set to &P13_ACCTNO.
But it still only works partly, I don't know why?
any other ideas?
Thanks so much for your help so far, both of you.
Regards,
Denise
Similar Messages
-
How to execute a statement in application process on new authentication
Hi all,
How can i execute a statement such as
set role TABLE_NAME identified by sunil;
in my application process?
I have tried exec('set role TABLE_NAME identified by sunil');, but wasn't successful. Does anybody knows the problem in my syntax?
Thanks,
Sunil Bhatia
Edited by: Sunil Bhatia on Jun 25, 2009 12:33 PMCan you proceed me to this direction?No, it's still the wrong one.
DB roles are not used in APEX due to fundamentals of APEX and Oracle architecture: this is clear when it is understood Re: Priveleges to create procedures/functions in schemas (points 3 & 4 being most relevant to this issue – and read "APEX" for "HTML DB")
(If anyone knows of a more "official"/complete description of what goes on under the covers than the referenced Forum post it would be helpful to know about it.) -
How to set the value of application item using pl/sql in application process
Hi guys,
I want a global variable (application item) whose value will be set at the start when a user logs in to the application. The value will be retrieved from database using a sql query. I do not know the exact syntax to set the value of application item in application process. Also i want to know in which type of application process should i use to set the value of application item when a user starts a session. The value of application item varies from user to user.
Please help.
I am using apex 4.2
Regards,
WaqasYou can use the application item as bind-variable with its name. ie. your application item is named G_MY_APPLICATION_ITEM, then you can access/set it using :G_MY_APPLICATION_ITEM.
For example
BEGIN
-- assign like a variable
:G_MY_APPLICATION_ITEM := 'LARRY';
-- use in a SQL statement
SELECT WHATEVER_COLUMN
INTO :G_MY_APPLICATION_ITEM
FROM MY_TABLE
WHERE USERNAME = :APP_USER
END;
Peter -
For Loop with parameter in application process
Hello,
I am working on a project for school and a loop in an application process is giving me a headache. I have an application from which I make an ajax call to an "on-demand" process. Here's a short version of the process:
declare
valuesList varchar2(32000) := '';
sqlWhere varchar2(32000) := '';
begin
begin
//calculations, but let's hard code sqlWhere for demonstration purposes
sqlWhere := ' where ID = 50';
for j in (select * from myview sqlWhere) loop
valuesList :=valuesList || '~rowsep~' || j.id || '~colsep~' || j.beds;
end loop;
exception
when no_data_found then null;
when others then HTP.p('Error: ' || SQLERRM);
valuesList := substr(valuesList, 9, length(valuesList));
end;
htp.prn(valuesList);
end;
I thought the for loop would contain only one record but it lists all records in the view. Interestingly, when I replace the loop condition to 'select * from myview where ID = 50' it returns what it's supposed to.
Could someone please explain what I am doing wrong?
Thank you!There are a couple of different options but using a variable in the sql statement and not the where clause needs an execute immediate. The link below gives a good overview and options to accomplish what you are trying to do.
execute immediate with for loop
Edited by: tread on Apr 23, 2012 1:09 PM -
Aplication Vs. Page level items for application process
Hi,
I have many application processes in my applications, many of them take parameters.
Right now I am passing parameters using page level temporary items. This is causing each page to have many items that are only used for calling the application process.
Is it better to use application level items for this purpose?
any pros and cons for each of these?
~KetanArie,
Are you saying that the condition only apply to rendering the item, but the APEX engine will still consider such an item a valid “internal” variable?
Yes. The absence of a condition on a page item or a condition that evaluates to true simply allows it to be rendered on the page. The existence of the item in the page definition allows it to hold session state.
We're planning to introduce a non-displaying page item type just for this purpose, sort of a scratchpad variable with no display properties, like an applicaition item but defined on a page.
Scott -
Application process is not getting the data from table
I have created the following application process based on AJAX select value but using a pop up LOV
DECLARE
my_det VARCHAR2 (200);
BEGIN
SELECT DM_00010_CUST_NAME INTO my_det
FROM ODM_MD_00010
WHERE DM_00010_CUST_CODE = nvl(:P11_DT_00020_CUST_CODE,21);
exception when no_data_found then null;
HTP.prn (my_det);
END;
the process is getting no data found error ( hence the exception) so I am getting NULL in the name field on screen.
any help ?the javascript I have in the region header is:
<script language="JavaScript" type="text/javascript">
function f_getDet ()
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
get.add('P11_DT_00020_CUST_CODE',html_GetElement('P11_DT_00020_CUST_CODE').value)
gReturn = get.get();
if(gReturn)
{ html_GetElement('P11_DT_00020_CUST_NAME').value = gReturn }
else
{ html_GetElement('P11_DT_00020_CUST_NAME').value = 'null' }
get = null;
</script> -
Application process code is not getting the value
Hi
I have implemented search functionality on page 0 (One Textbox and one ImageButton).
on clicking on image button
I am calling a application process to redirect a page on the basis of entered value.
I am using following code in application process:
DECLARE
l_number NUMBER;
rec_count NUMBER;
BEGIN
l_number := TO_NUMBER(:P0_SEARCH);
SELECT COUNT(*) INTO rec_count FROM CASE_DATA WHERE CASE_NUMBER = l_number;
if rec_count >= 1 then
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:42:&SESSION.::&DEBUG.::P42_CASE_NUMBER:l_number');
End if;
exception
when others then
NULL;
END;
:P0_SEARCH is the name of search textbox that is on page 0.
when i clicking on image button then this value of l_number is not passed to the
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:42:&SESSION.::&DEBUG.::P42_CASE_NUMBER:l_number');
its giving an error
ORA-01722: invalid number
and in url its showing
http://apex.oracle.com/pls/otn/f?p=31774:42:16398188927210884::NO::P42_CASE_NUMBER:l_number
but its working if i am putting the static value as
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:42:&SESSION.::&DEBUG.::P42_CASE_NUMBER:22');
its redirecting the right page as
http://apex.oracle.com/pls/otn/f?p=31774:42:16398188927210884::NO::P42_CASE_NUMBER:l4
So, please help me how to pass the value to redirect.
Thanks
-PMHi,
Try
OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:42:&SESSION.::&DEBUG.::P42_CASE_NUMBER:' || l_number);Br,Jari -
APEX Application Process Automation
In my app, I have to keep track of people who are going on vacation and when they are coming back to work; In my employee table, there is a column named status that shows whether they are on "Vacation" and when they are "On-Duty". Based on the status column, these employees will be listed on one of two report pages - Employees - On-Duty and Employees - On Vacation
There are two tables which are being used.
1. Emps
2. Leave
In the Leave table there is a start_date, end_date and Leave_type that is associated with a employee record in the employee table. The Leave_type column shows what type of leave that particular person will be going on in the next month.
My goal is to create an automated process that changes that "status" column for the employee in the employee table, when the start_date in the leave table ='s the current date.
Can someone make a suggestion on how I can automate this process and point me in the right direction as to how to code this?
My First issue with the req is that I am not sure what feature I should use to reach my goal.
Should I use an Application Process, Application Computation, or an OnLoad Page event.
My second issue that as I am familiar with SQL, but I am not too savvy, yet, with PL/SQL. I am not sure how to write the PL/SQL code to faciliate this need. Below, is a pseudo-code that I have outlined.
1. Open cursor for all employees who are in On-Duty status.
2. Within that cursor, find the last leave_table row entered in the db for each employee.
3. If start_date is = to current_date, update employee status column to = leave_type column in the leave_table.
Any help would be greatly appreciated.
{PR}
Message was edited by:
pruiz1It will be very difficult for me to change the status column in the reports. Reason being, I have about 7 categories for employees/prospects that are being used in the emp table.
1. On-Duty
2. R&R
3. Adminstrative leave
4. Standby - waiting to be hired on contract
5. Disqualified and
6. Terminated
7. Resigned
If there were only two statuses On-duty and R&R(vacation), i would have no problem doing so. Also, i have had some issues modifying views in APEX, which I never sorted out.
For 3-5, I cannot think a scheme to use so that I can move the status column from the emp table to the leave table.
For 6-7, I have a work_history table that is joined to the employees who are in this status. Once a person is terminated or has resigned, the work_history table is updated manually by the field.
{PR}
Message was edited by:
pruiz1 -
On Demand Application Process not working on IPad or IPhone
I have application processes that use AJAX to refresh my select list values (see code below). They all work fine on normal devices, but they do not populate at all if I try from an IPad or IPhone. Any ideas?
HTML Form Element Attributes:
onactivate="get_select_list_xml1(this,$x('P507_FORMS'),$x('P0_LOGIN_SCHOOL_YEAR'),this,'REFRESH_REPORT_LAYOUT_LOV');" onfocus="if((typeof this.onactivate)!='function'){get_select_list_xml1(this,$x('P507_FORMS'),$x('P0_LOGIN_SCHOOL_YEAR'),this,'REFRESH_REPORT_LAYOUT_LOV');}"
Application process:
BEGIN
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<select>');
FOR c IN (SELECT '2' o, A.report_layout_desc d, A.report_layout r
FROM form B, report_layout A
WHERE A.fk_form = B.pk_id and
B.form = :REFRESH_LOV_PK_ID
ORDER by 1,2)
LOOP
HTP.prn ('<option value="' || c.r || '">' ||
c.d || '</option>');
END LOOP;
HTP.prn ('</select>');
END;bobmagan wrote:
It fires on both onactivate and onfocus. I had to do that to work on the Mac clients. Look at the code:
onactivate="get_select_list_xml1(this,$x('P507_FORMS'),$x('P0_LOGIN_SCHOOL_YEAR'),this,'REFRESH_REPORT_LAYOUT_LOV');" onfocus="if((typeof this.onactivate)!='function'){get_select_list_xml1(this,$x('P507_FORMS'),$x('P0_LOGIN_SCHOOL_YEAR'),this,'REFRESH_REPORT_LAYOUT_LOV');}"What about just
onfocus="get_select_list_xml1(this, $x('P507_FORMS'), $x'P0_LOGIN_SCHOOL_YEAR'), this, 'REFRESH_REPORT_LAYOUT_LOV');"If not, supply the following information:
<li>Full APEX version
<li>Full DB version and edition
<li>Web server architecture (EPG, OHS or APEX listener)
<li>Browser(s)/version(s) used
<li>Theme
<li>Template(s)
<li>Region/Item type(s)
and the <tt>get_select_list_xml1</tt> JS code.
Post code wrapped in tags<tt>\...\</tt> tags to preserve formatting and special characters. -
Applescript and application process name on osx 10.10
I have an application that I'm running on OSX, and I have this AppleScript that was working on 10.9, but it seems that it does not work on 10.10
try tell application \"System Events\" to set processPath to application file of application process "My Application" return POSIX path of processPath on error errMsg return "" end try
When I run this in the AppleScript editor, it gives me the error that "System events got an error: Can't get application process "My Application".
I checked the Activity Monitor, and indeed, there is no process called "My Application" in there. The associated process with my application is now registered by the name "SWT". I confirmed this by killing the "SWT" process, and it killed my app.
I tried setting the Application name to "My Application", (using Display.setAppName("My Application");) inside my code, which worked, and now I am able to see a process called "My Application" in the Activity Monitor, but the AppleScript is still not working. The new error that I'm getting now is:
Can’t make alias \"Macintosh HD:Library:Java:JavaVirtualMachines:jdk1.7.0_71.jdk:Contents:Home:bin:java\" of application \"System Events\" into the expected type
My question is, what has changed from 10.9 to 10.10, and why is my application registered as "SWT" process, instead of "My Application", as it was in 10.9?I have an iMac 2.16GHz and a MacBook 2.4GHz. Both were running 10.5.2; I have since updated the iMac to 10.5.3. I also have an old machine running OS X 10.2.8 server. (OK, laugh. But it works!) Before upgrading my iMac to 10.5, I could copy files to and from that server pretty quickly.
Now, anything of size takes forever. I am connecting over wired ethernet (but wireless, having tried, is no better). I have a Airport Extreme router with Gigabit, and a separate Asante 8-port 10/100 switch. No matter how anything connects, a transfer of 200mb or so takes almost 30 minutes.
I brought a friend's machine over running 10.4.11, and it transfered to the old Mac server the same 200mb file in less than 3 minutes or so. What I would expect.
Thinking maybe the old 10.2.8 server was too old for 10.5, I subbed in another machine running 10.4.11 server. The times to it were terrible, too, from any of the 10.5 machines.
I tried turning off IPV6, then the times went to hours to copy, so I turned it back to Auto. I have read that maybe there are other network settings (such as those changeable with a tool such as Cocktail) that could be the culprit. I have not explored that.
This post is definitely not closed or solved!
Pete -
Web application processing terminated
Hi Fellow SDNers,
My user is trying to execute a report from a portal. He is getting the below error while executing the report:
Web application processing terminated
Diagnosis
The system had to terminate processing of the Web application.
The reason could be that the system was no longer able to find the Web application server session.
System Response
Processing the navigation step is not possible.
Procedure
Call up the Web Application again.
Note: Use the start URL and not the URL that is currently displayed in the Web Browser.
Procedure for System Administration
Notification Number BRAIN 278
However, when I tried running the same report from the portal with same user credentials, I'm not getting any error.
I suspect, its due to the IE setting. I got the cookies and offline IE files deleted from the user, but all in vain. User still faces the same issue. I'm still wondering, its not a issue with the BI system. This might be due to some network settings or IE settings.
But the issue is only for one report, rest of the reports are running fine for the user.
Kindly help me, if anyone has faced this issue earlier.
System Details:
Patch: SAPKW70015
release: 7.0
Regards,
SatyamHi,
Check if the entry exists in table RSZWVIEW for your report.
Regards,
Durgesh. -
Invoking a webservice as an "application process"
Hello there,
I have setup a web service successfully and I can invoke it as a "Page Process", get the response in a collection , and do a few validation based on it.
However, I will need this validation for most of my pages in the application, so I thought, I would rather run it against the application as a whole.
The issue came when I try to invoke the web service as an "Application Process" rather than a page process. Unfortunately APEX does not seems to give an option to invoke a web service on application level as it does for page level.
For Application Process, apparently I can only run a PL/SQL block, which is fine; if I know how to make a call to the web service and fill the collection from a PL/SQL Block.
My application does not have a particular page as "home entry"; users basically will be accessing different pages as entry points. I really don't like to invoke WS calls on each of the page to get the collection filled, so my validation could run - I mean I will have only this option unless this tread yield me with an alternative :)-
I am sure someone must have gone through similar situation, and hopefully could provide a solution or workaround for me.
Thanks a lot in advance
Regards
Ligon GopinathanLigon:
Yes, using NTLM authentication does complicate things a bit. However, I think it may be possible to to achieve the goal of pushing all users to a fixed landing page upon successful session establishment by the NTLM page-sentry function and from thereon to the page the user requested. This landing page will have 2 'before header' processes , one that will call the Web Service and the another that will simply re-direct the user to the page that was initially requested.
In the page-sentry function you can modify the call to 'wwv_flow_custom_auth_std.post_login' such that the parameter
p_flow_page is set to 'apex_application.g_flow_id ||':'<landing-page-id>'
You will also need to save off the actual page requested( the value of apex_application.g_flow_step_id) into an application_item which you can then reference in the pre-header process of the landing-page.
I must caution you that I have not tested whether this approach will work but decided to throw this out here anyhow :)
Check http://www.oracle-base.com/articles/10g/utl_dbws10g.php out for a how-to for calling out to Web Services using PL/SQL .
Varad -
I have a windows 7 premium laptop, 64 bit driver, have tried to install itunes but recieve an error when trying to open. Error states "Apple Application Support is required to run itunes. uninstall and reinstall again, error 2 (windows error 2). have tried this 4-5 times with no success. help!
For general advice see Troubleshooting issues with iTunes for Windows updates.
The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
The section Install missing components has advice on breaking down the iTunes installer into the individual .msi files which might prove useful if AAS won't install normally.
tt2 -
I get an error that states "This application has failed to start because MSVCR80.dll was not found". Reinstalling does not help.I have tried removing iTunes and reinstalling, I have tried "repairing" option at reinstall, nothing seems to work.
Read this:
iTunes 11.1.4 for Windows - Unable to install or open - MSVCR80 issue -
Use APEX_APPLICATION in an application process called by a javascript
I have a page that is split into two; Top portion is a form, and the bottom part is a tabular form of a collection. Currently, if I enter information into the form and the collection and then submit the collection (to save the data to the collection) it erases the information in the form (since submitting for the form is separate). The same thing happens when I attempt to delete certain rows from the collection.
My solution to this problem was to use javascript to call an application process (that way the page isn't completely refreshed, only the collection portion). However, I can't seem to get the apex package APEX_APPLICATION to work correctly as an application process (works fine as a process on submit as a page process).
Below is the way I use apex_application for saving:
begin
for x in 1..apex_application.g_f03.COUNT
loop
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 8,
p_attr_value => apex_application.g_f08(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 9,
p_attr_value => apex_application.g_f09(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 10,
p_attr_value => apex_application.g_f10(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 11,
p_attr_value => apex_application.g_f11(x));
apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
p_seq => apex_application.g_f03(x),
p_attr_number => 12,
p_attr_value => apex_application.g_f12(x));
end loop;
end;
Below is the code I use for deleting certain elements from the collection:
BEGIN
FOR ii IN 1 .. apex_application.g_f01.COUNT -- checkbox
LOOP
apex_collection.delete_member (p_collection_name => 'SPECIES_COLLECTION',
p_seq => apex_application.g_f01(ii)
END LOOP;
APEX_COLLECTION.RESEQUENCE_COLLECTION('SPECIES_COLLECTION');
END;
Below is the javascript I attempted to use for application process for submitting:
function addToCollection()
var get =
new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=submitLandings',0);
gReturn = get.get();
get = null;
}Your requirement is quite similar to what I have here:
http://apex.oracle.com/pls/otn/f?p=31517:159
Using apex_application.g_fxx will not work in the way you originaly planed to do that since an application process can't see it.
What you can do is to use an application process to update the collection at the moment you enter your data. Apply for an account (see login page of my demo application) and you may see how I solved it in my example.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Maybe you are looking for
-
Ical to iweb: monthly view
I managed to embed my iCal into iWeb, but I can't seem to get rid of the mini months on the side or get it to publish in "month" view instead of "weekly" view. Any suggestions of how to correct this problem? Thanks
-
Error 0x800704b3 when trying to map a network drive
Hi there, I have the following error when trying to map a network drive in my home network: "\\iomegahmd can not be reached" and the error code is 0x800704b3. I already looked into the services, and my strong assumption is that the problem is that th
-
Why won't my computer recognize my iphone 5?
I have an iphone 5 that in the past has had no trouble connecting to my windows computer. Recentlly though, it is syncing my pictures and music just fine though wifi, but when I try to plug it in through the USB port, my computer nor itunes recognize
-
I had Airport Utilities in my Mac Book 2009 with OsX 10.9.2 , I can online with My Airport Extreme A 1408 via Wifi. But Airport Utilities cannot configure Airport Base Station. And I don't see the update . I used my Ipad Air to update newest firmwar
-
Does Screen Resolution Cause Display Problems?
I just picked up my new 15 inch Retina Macbook Pro with 750m and I changed the screen resolution to the second option,the one with the bigger text but i am noticing that when i close a window, a white horizontal line comes up around where the window