Accessing Session State in query - sql

I Have the following URL
.../ords/f?p=1575:31:12296330498768::NO::CONTRACTID:2
And as you can see I have set the session state of CONTRACTID to 2.
I want to acces the value of CONTRACTID in the following SQL:
SELECT
CON_CONTRACT.CONTRACTDATUM AS CONTRACTDATUM,
CON_CONTRACT.BEGINDATUM AS BEGINDATUM,
CON_CONTRACT.EINDDATUM AS EINDDATUM,
CON_KLANT.NAAM AS KLANT,
CON_VERKOPER.NAAM AS VERKOPER
FROM CON_CONTRACT, CON_VERKOPER, CON_KLANT
WHERE
CON_VERKOPER.VERKOPERID = CON_CONTRACT.VERKOPERID AND
CON_KLANT.KLANTID = CON_CONTRACT.KLANTID AND
CON_CONTRACT.CONTRACTID = :CONTRACTID
I reference the Session state using :CONTRACTID as per the documentation
When accessing the report with the above SQL I get the following error
ERR-1002 Unable to find item ID for item "CONTRACTID" in application "1575".
Unexpected error, unable to find item name at application or page level.
And the following Technical Info
is_internal_error: true
apex_error_code: WWV_FLOW.FIND_ITEM_ID_ERR
error_backtrace:
----- PL/SQL Call Stack -----
object line object
handle number name
0x148b83330 556 package body APEX_040200.WWV_FLOW_ERROR
0x148b83330 607 package body APEX_040200.WWV_FLOW_ERROR
0x148b83330 911 package body APEX_040200.WWV_FLOW_ERROR
0x14b2992c0 2607 package body APEX_040200.WWV_FLOW_META_DATA
0x14c01ff10 3334 package body APEX_040200.WWV_FLOW
0x14c01ff10 4860 package body APEX_040200.WWV_FLOW
0x14c0d60c8 249 procedure APEX_040200.F
0xa04c0228 2 anonymous block
I've tried replacing :CONTRACTID with V('CONTRACTID') and NV('CONTRACTID') but that didn't do anything

CONTRACTID have to be an application item or page item. You can't just pass any string in URL as identifier and use it in query. To create page item:
open desired page (page with query in your example)
click + sign (if you are working in Component view mode) in the Items section
give a name to your item
if you don't need to show item on a page, you can make it hidden (Display as - Hidden in the item properties)
To create an application item go to Shared Components -> Application Logic -> Application Items and create an item there.
After creating of a page item or an application item you can use their names in URLs and in report queries. The main difference between application items and page items - application items are accessible in the whole application, page items - only on their pages.

Related

Create telegram bot Keyboard from JSON file depending on user menu selection

I am creating a telegram bot that requires a dynamic menu to be created depending on the user's previous menu selection. The dynamic menu should pull from a json file and a specific key:value. Required keyboard is the KeyboardButton and NOT an InlineKeyboardButton.
Example: User is presented with a menu that is A-F, G-L, M-R, and S-Z. When they select the button A-F I am looking for a dynamic menu to be built from the json file where Name is sorted from A-F. The user would then select a name from the new menu and information would be presented associated with that name.
I am lost on the dynamic menu portion for the af_menu_keyboard. Other menus are no problem and can retrieve what I need from that json file.
Anyone know how to achieve this?
result = os.popen("curl https://api.mainnet.klever.finance.....")
details = json.load(result)
def messageHandler(update: Update, context: CallbackContext):
if "A-F" in update.message.text:
update.message.reply_text(node_menu_message()),
reply_markup=af_menu_keyboard():
if "Back" in update.message.text:
update.message.reply_text(main_menu_message(),
reply_markup=main_menu_keyboard())
def first_menu_keyboard():
buttons = [[KeyboardButton("A-F"), KeyboardButton("G-L"), KeyboardButton("M-R")],
[KeyboardButton("S-Z"),KeyboardButton("Back", calback_data='main')]]
return ReplyKeyboardMarkup(buttons,resize_keyboard=True)
def af_menu_keyboard():
buttons = **** Create menu with multiple values from the API JSON file above ****
return ReplyKeyboardMarkup(buttons,resize_keyboard=True)

Using send_keys() on a search/filter input field does not filter results in table

There is a table with a list of users and their email on a webpage. At the top of the page, is a search/filter input field that allows the user to type an email or username and filter for the result as he/she is typing.
The problem: However, when I use the send_keys() method instead of doing this manually, nothing is filtered in the table view.
This is happening on the Safari browser on the iPhone 7 Plus (real device, not simulator). Some other information:
iOS version: 12.2
Appium version: 1.13.0-beta.3
Selenium version: 2.53.1
Programming language: Python 2.7.15
In addition to send_keys(), i've tried to use set_value(), i've also tried to execute JS and setting the attribute value, and also tried to send key for each character (in a for loop with a delay between each character).
I'm expecting for example, element.send_keys("test1000#test.com) to filter the table view on the web page so that the only user that is displayed has the associated test1000#test.com email as it does when I go through the site manually.
In actuality, send_keys() does not do that and nothing in the table view gets filtered.
Any help or guidance would be appreciated!
Explicit wait for table to get populate in DOM
sendKeys search String and additional key Tab
textbox.sendKeys("test1000#test.com"+Keys.TAB)
Explicit Wait for filter to get applied and table to get refreshed.
find elements for the newly populated table with applied filters.

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;

How to force the parse (only one time ) of a Dojo's button [Err: widget is already registered]

I have a function which adds a button to a div "dettaglio_utenti". After calling the function with this instruction
tab+="<button data-dojo-type='dojox.mobile.Button' id='apri_mappa' onClick=\" location.href='tel:"+telefono+"'\">apri mappa</button>"
var vText = document.getElementById("dettaglio_utente");
vText.innerHTML = tab;
require(["dojo/parser"], function(parser){
parser.parse(vText);
});
It works only the first time that I display the page. The second time the button is not parsed and I see this error in the browser console: dojo/parser::parse() error Error: Tried to register widget with id==apri_mappa but that id is already registered
When you display the page for the second time, the first page must still be part of the dom. (Maybe this is a worklight feature, single page app?). So when dojo parses the second page it gives the error because the button with that id has already been created.
I don't believe preventing the parsing of the button a second time will accomplish what you need. I think your options are:
Destroy the widgets from the first page.
If you don't need an id on the button, you can omit it and Dojo will create an id that won't collide.
If you need the id, you can or use a counter when emitting the id of the button.
id='apri_mappa_' + i where i is the counter.
Only knowing what you wrote above, I think the order of preference is 2,1,3.
EDIT - How to destroy a widget
require(['dijit/registry'], function(registry) {
registry.byId('apri_mappa').destroy();
});

Storing dynamic text in Selenium

I'm new to Selenium and had the following question about storing dynamic text...
In our web application, when a function is performed (i.e. transfer), a confirmation message is displayed (i.e. "function is completed. The reference number is #12345". The ref number is then displayed in a list with other ref numbers on another page. As part of my test, after the ref. number is generated, I would like to select from the list the ref number that was just generated.
Example
1 create item.
2 confirmation message displays
3 save ref number
4 navigate to other page which contains list of ref #s
5 select item from list that was just created (select using ref #)
Question: How do I save the ref number from the confirmation message so that I have Selenium select that number from the list of ref #'s?
Thanks,
D
Find out the identifier (CSS/XPath/etc.) of the UI element that displays the reference number, and then use the relatively getText() command. In Java,
String text = selenium.getText("your_identifier");