Save last {{!loop}} value in iMacro script after error - imacros

I am running an iMacro script in the free FF Extension format.
This Macro runs all night in a loop and uses the {{!LOOP}} variable. During the night the script might crash and when it does I need a way to see at whatvalue of {{!LOOP}} the script crashed in order to pick off at that part.
How can I save the last {{!loop}} value in iMacro script even after an error?

I use the following code to update the url on the next tab to be !LOOP so when it crashes the value there is exactly what you need. You need the 2nd tab to already be open. This method is very quick!
TAB T=1
'your code goes here
'don't wanna wait long
SET !TIMEOUT_PAGE 1
'don't crash because http://1 doesn't exist
SET !ERRORIGNORE YES
'go to next tab - notice this tab has to already be open
TAB T=2
'update url in tab
URL GOTO={{!LOOP}}
'return to original tab
TAB T=1
'timeout back to normal
SET !TIMEOUT_PAGE 60
'continue failing on error like in default
SET !ERRORIGNORE NO
You can also save to disk for more reliability and tracking of individual loops that failed if you want to continue even when failing.

expending the answer above me you can use your macro just go to url's like : URL GOTO=www.yoururl.com/?nothing={{!LOOP}}
by adding ?nothing={{!LOOP}} most sites won't be affected but the result is the same as opening a new tab to {{!LOOP}} without the new tab

Related

Pass values between pages Oracle APEX

There is a problem transferring values between pages in the application. I have 2 pages on the first page there is a variable P9_ITEMID (when you run page 9, in this variable SQL Statement query writes the data). There is a second page 181. I want to move data from variable P9_ITEMID to variable P181_ITEM. To do this, I use the 'redirect to page in this application' option. But it doesn't work. Although I see in the variable P9_ITEMID there is data. But when you go to page 181 but P181_ITEM is empty. I would be grateful for help))
P9_ITEMID is a virtual variable that is not assigned to any column in the table. This mmin simply displays data. When I start the page, I see the data that was written to it due to the dynamic action
also i tried to write the value in P9 ITEMID this way
My code:
declare
v_empname items.id%type;
begin
select id into v_empname
from items where id = :P9_ITEMID;
apex_util.set_session_state('P9_ITEM_ID', v_empname);
exception
when others then
apex_util.set_session_state('P9_ITEM_ID', null);
end;
I'm assuming that you have created a button with action: 'redirect to page in this application' and you want the session value of a page item to be passed to the target page.
When an url is constructed using link builder, the link is built at page rendering time. It does not pick up any changes in session. Even when you set the session state in a dynamic action, it will not pick it up because the url is already rendered.
To pick up any changes on that page, it is necessary that the page item value is set in session state and this is done by the "page processing".So if you use "Submit Page" on the button and create a branch to redirect to the page it will behave the way you want.

Oracle APEX - Transferring page item value from one page to another

Not sure what am I doing wrong and need help to diagnose the issue.
I have an apex page with an IG on it with radiobutton selection column, allowing the user to select only one row at a time.
On row select I use javascript to grab the ID of the selected row and then use Execute PL/SQL
NULL;
in order to store the value into the session state of P2_ID.
I also have a button on the page that has another page as a target - page 3, and I need to get my P2_ID value to that page.
So I set the page item of a target page - P3_ID ro &P2_ID. in a Link Builder - target pop up window. Along with that I pass another page item P2_TEST, which has a static value.
Now when I get to page 3, I do not see P3_ID in the session state while I do see P3_TEST and it does have a value, but P3_ID is not even listed... What am I doing wrong here?
How about this: instead of executing NULL; when pushing the button, SUBMIT (submit will certainly store values into session state). Create a branch which takes you to page 3; among branch properties, you'll find an option to set P3_ID to P2_ID

Updating values, one control to another

History, I am an experienced PL/SQL dev learning to use Apex and struggling with some of the concepts. Before working with PL/SQL I worked with various platforms including Delphi and VB.
Problem, how to pick up the value set in component from another component. The object of the exercise is to make the report in an interactive grid change dependant on a value selected in a drop down, the value in the drop down being in the where clause as a bind var. My original setup for this did not work. After various experiments with this I produced this test case where the object is for the label to display the value selected in the drop down:-
Page view
P300_SELECT (left) is a simple drop down, unmodified with the default values. P300_SELECTED_VALUE is a label set to display the value in P300_SELECT:-
Component setup
This does not work! And it continues not to work when I change the source setup of the label to be STATIC VALUE and set the value to &P300_SELECT.
I have also tried adding a CHANGE dynamic action on the drop down to call refresh on the label, it still does not work! In desperation to confirm that the value was indeed changing for the drop down I added a second true action to the change event executing the following javascript:
apex.message.alert($v("P300_SELECT"));
Sure enough, this works showing that the event is firing and that the value is correct:-
Label no change, but alert message works...
SO WHAT IS HAPPENING?
Why does the label not update even with a refresh called on it?
What do I have to do to make this work?
Thanks in advance for your help!
Bob
To do this
1 - Create one dynamic action to start when you change the value of P300_SELECT.
2 - Now there is a lot of ways to do this step, but I will sugest to do in this way. Create one true action in this dynamic action, this true action is "Execute PL/SQL code". The code is:
BEGIN
:P300_SELECTED_VALUE := :P300_SELECT;
END
In this true action put the item P300_SELECT in the field "Items to submit". And the item P300_SELECTED_VALUE in "Items to Return".
3 - Now create one more true action in this same dynamic action. This true action is "Refresh" and select the region of your report/IG.
***If the item P300_SELECTED_VALUE is just to test, so discard the first true action above and fill the field next of your select statement "Page items to submit" with the item P300_SELECT.
Why what you have try don't work?
1 - The source section is used to set the value when the page is loaded, this setup not affect changes after the page is loaded.
2 - The report is not refreshed because the item is not in the session after you change it.
Ex. https://apex.oracle.com/pls/apex/f?p=145797:15
Use this workspace to check something:
workspace: STACKQUESTIONS
user: test
password: test
app: 145797
page: 15
login on: https://apex.oracle.com/pls/apex/f?p=4550

How to send page item values to another page without appending in url Apex 5.1.3

I am trying to redirect to another page on button click and I am setting an item value of 2nd page with value from first page.
But I can see that it is sent as a query string http://localhost:8080/apex/f?p=104:3:16676730353670::NO:RP:P3_NEW:hi
Is there any way I can send this as hidden without appending to query?
Thanks in advance
One option is to pull instead of push.
Value of P5_FINALTABLE should be in session state (for example, submit it when Enter pressed), otherwise it won't work.
Then, set P3_NEW item's "Default value" to "PL/SQL Function body" as
return :P5_FINALTABLE;
Run Page 5, enter something (for example, 555) into P5_FINALTABLE, press Enter, navigate to Page 3 and - 555 should be visible in P3_NEW item.

Possible To Enter An Entire List in a Text Field with iMacros?

Is it possible to enter a whole row of data into a text box (1 keyword per line) with iMacros?
Problem:
I have a whole list of keywords (Column A in CSV file) I am trying to paste into a text box with iMacros.
All the solutions I've found involve using !LOOP to reload the whole page and extract the keyword row by row, though with ~800 keywords I'm trying to find a more efficient way.
I know I can integrate iMacros with VBA or javascript, but that would also involve looping data entry row by row [albeit a smaller segment of code], though this still seems inefficient.
Any help would be greatly appreciated.
Let’s suppose that the ‘keywords.txt’ file is like this:
keyword1
keyword2
keyword3
keyword4
keyword5
and placed in the default ‘iMacros’ datasource folder. So you can try to read it at once with the help of the following code:
TAB OPEN
TAB T=2
URL GOTO=file:///{{!FOLDER_DATASOURCE}}/keywords.txt
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=HTML ATTR=* EXTRACT=TXT
TAB CLOSE
'PROMPT {{!EXTRACT}}
Note, if you have a more complicated CSV (not TXT) structure of the file, it’s possible to use the JavaScript Scripting Interface (for Firefox extension) in order to read and process it efficiently as well.