When I run this code it says ${month} not found and ${month status} is returning True:
${month status}= Run Keyword and Return Status Element Should Be Visible xpath=//div[#data-title='Cost for Month']
Run Keyword If '${month status}' == 'True'
... ${month}= Get Text xpath=//div[#data-title='Cost for Month']
... Log Dashboard is displaying ${month} Cost Usage for month Text
... ELSE
... Fail Cost Dashboard is not displaying Cost Usage for month Text
${month status}= Run Keyword and Return Status Element Should Be Visible xpath=//div[#data-title='Cost for Month']
${month}= Run Keyword If '${month status}' == 'True' Get Text xpath=//div[#data-title='Cost for Month']
Run Keyword If '${month status}' == 'True' Log Dashboard is displaying ${month} Cost Usage for month Text
Run Keyword If '${month status}' == 'False' Fail Cost Dashboard is not displaying Cost Usage for month Text
A bit of a crude solution but we came across this situation as well, and solved it using the fix above.
I think your code was failing because ${month} was being interpreted as a keyword rather than a variable.
Related
var a = $v('P1995_LUMBER');
if ((a = '1')) {
apex.submit({
request: "CREATE",
set: {
LUMBER: "P1995_LUMBER",
LST_NME: "P1995_LST_NME",
FST_NME: "P1995_FST_NME",
},
});
} else if (a != '1') {
apex.submit({
request: "Update",
set: {
LUMBER: "P1995_LUMBER",
LST_NME: "P1995_LST_NME",
FST_NME: "P1995_FST_NME",
},
});
} else {
alert("bang bang");
}
Couple of things:
JavaScript's equality check is either == or === (more details here). (a = '1') assign '1' to the variable.
It seems like you're not using the apex.submit process correctly. Typically, you would set the item's value
e.g.:
apex.page.submit({
request: "SAVE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
}
} );
Although, by looking at your JavaScript code, I would say you don't even need to use JavaScript.
Whenever you submit a page, all items on it are automatically sent to the server-side. You can then reference them using bind variables. You could then simply have two process, one for the Create and one for the Update, each having the corresponding insert/update statement using the different items on your page.
Usually what you will see is a page with two buttons for Create/Edit. They will have a server-side condition so that only the correct one is displayed.
Try creating a Form type page (form with report) using the wizard, and you'll see how everything is done.
Without seeing the page and the code you're using it's hard to tell what your issue really is, more details would be required.
That code does not have any sql in it so it is impossible to diagnose why you are encountering a TOO_MANY_ROWS exception. Run the page in debug mode and check the debug data - it should show you what statement is throwing the exception. If you need more help, post a proper reproducible case, not a single snipped of code without any context.
I am trying to generate a large number of html files using rmarkdown::render in a loop, with Parameterized reports.
After generating a number of files, it stalls, and I have to restart RStudio. I can generate each individual file in itself; it is not at the same file it stalls each time when I try running the loop.
There is no error message, making it hard for me to debug.
I have tried the following, none of which helped:
Closing all other programs; reducing the memory used.
Adding knitr::knit_meta(clean = TRUE) before render
Adding clean = T inside render
Calling render with callr::r
Including rm([[data]]); gc() at the end of the .rmd file that is called by render
Any other ideas of how to try and solve this issue?
Taking This from R Markdown: The Definitive Guide Where an example is used to render multiple files. Every file would have a it's own name regarding it's param region and year.
render_report = function(region, year) {
rmarkdown::render(
"MyDocument.Rmd", params = list(
region = region,
year = year
),
output_file = paste0("Report-", region, "-", year, ".html")
)
}
Here is my code:
In If Controller -> Condition (Default Javascript) I am providing following
"${responsecode}" == "404" || "${responsecode}" == "500" && "${responseMessage}" == "Not Found"
Yes you can, assuming your current condition SMTP Sampler will be executed:
If ${responsecode} variable is 404
OR
If ${responsecode} variable is 500 AND ${responseMessage} variable is Not Found
I doubt that you will get Not Found message given Response Code 500, most likely you will get an Internal Server Error there so maybe you should amend your condition to look like:
"${responsecode}" == "500" || ("${responsecode}" == "404" && "${responseMessage}" == "Not Found")
In case when If Controller doesn't behave as expected first of all check jmeter.log file for any JavaScript-related errors, it will give you some clue regarding what's wrong with your setup. You can also use __javaScript() function and View Results Tree listener combination to visualize the result of your If Controller condition:
See How to Use JMeter's 'IF' Controller article for more details on conditionally running samplers via If Controller.
I want to use If-Condition with multiple actions in Robot Framework
${x} Set Variable 5
Run Keyword If ${x} == 5
... ${Test1} = Set Variable MyName
... ${Test2} = Set Variable MyLastName
... Else
... ${Test1} = Set Variable MyAddress
... ${Test2} = Set Variable MyTelephone
But it is not working
Error show FAIL : Variable '${Test1}' not found.
Could you please tell me about using IF-Condition with multiple actions
You can use "Run Keywords" keyword to perform multiple actions in IF condition
Kindly go through below link:
IF ELSE in robot framework with variables assignment
You have to either cover both actions with one custom keyword and then call Run Keyword If or call the keyword Set Variable If twice or write such logic into python (jython...) library.
Please notice "And" while using "Run Keywords"; also ensure tab used.
Run Keyword If <condition1> <action1>
... ELSE IF <condition1>
... Run Keywords
... <action1>
... AND <action2>
Set Test Variable ${temp} rxu
Run Keyword if '${temp}'=='rxu'
... Run Keywords
... Log To Console this is one
... AND Log To Console This is two
... ELSE Run Keyword Log To Console another block
Refer following keyword :
Run Keyword If ${x} == 5 Set Variable MyName
Run Keyword If ${x} == 1 Set Variable LastName
Or
Run Keyword If ${x} == 5 Set Variable MyName
... ELSE IF ${x} == 2 Set Variable MyName
... ELSE IF ${x} == 3 Set Variable Middle Name
I am using python 2.7 and I am pretty new to python. I was wanted to ask why lines in my code are being skipped although I don't see a reason for them to be.
My code is seen below:
def add_client:
code for adding client
def check_clients:
code for listing out client info
modes = {'add': add_client, 'check': check_clients}
while True:
while True:
action = raw_input('Input Action: \n').lower()
if action in modes or ['exit']:
break
print 'Actions available:',
for i in modes:
print i.title() + ',',
print 'Exit'
if action in modes:
modes[mode](wb)
if action == 'exit':
break
When I run the code and input an action that is not in the list of modes, it does not print out 'Actions available: add, check, exit' and just seems to skip like seen below.
Input Action:
k
Input Action:
If I change the code to what is seen below it works as intended:
modes = {'add': add_entries, 'check': check_stats}
while True:
while True:
mode = raw_input('Input Action: \n').lower()
if mode not in modes:
print 'Actions available:',
for i in modes:
print i.title() + ',',
print 'End/Exit'
if mode in modes or ['end', 'exit']:
break
if mode in modes:
modes[mode](wb)
if mode in ['end', 'exit']:
break
Output:
Input Action:
k
Actions available: Add, Check, End/Exit
From my understanding, I thought that when an if statement is false, the code within the if statement is skipped and the code following should be ran, but for some reason, this doesn't seem to be the case here. Is there a reason for this or is my understanding of the if statement incorrect?
The condition action in modes or ['exit'] evaluates to True regardless of the value of action. It read like (action in modes) or (['exit']) (so you apply or operator to operands action in modes and ['exit']). Non-empty list ['exit'] evaluates to True in boolean context, so or returns True. You are suggested to use action in modes or action == 'exit' here to achieve your goal.