Do not set none when condition failed - robotframework

I'm using Robot Framework and I have an issue with the keyword Run Keyword If.
${test}= Set Variable Original text
${test}= Run Keyword If [Condition] retrieveColumnValue ${my_schema} ${my_sql_script} ${column}
retrieveColumnValue is a keyword to retrieve the column column from database schema schema after running the script my_sql_script. Its value will be assigned to the variable ${test} if [Condition] is True. But if it false, the variable will be assigned the value None. How can I make it stay the original value if the condition is false?

Related

pentaho report designer: if the value is null, then show a certain string

In my DB, some of values of a column (called status) are null, and if they are null, I want to show a String "canceled".
Guess I need to do it on Attributes - common -if-null but then don't know how to specify it.
Can anyone help me?
There are multiple options, as you said, Attributes - common - if-null on the field containing the status should do that, you can specify a String by entering it in the Value box. If your string disappears after unfocusing, click the ... while the Value entry is selected, that will launch a Popup-entrybox.
Alternatively, you could put that logic into your query
select coalesce(status, 'Cancelled')
from table
COALESCE
Evaluates the arguments in order and returns the current value of the first expression that initially doesn't evaluate to NULL. For example, SELECT COALESCE(NULL, NULL, 'third_value', 'fourth_value'); returns the third value because the third value is the first value that isn't null.
Some databases might have similar functions with different names, with Oracle e.g. there's nvl()

bind parameter inside a lexical parameter oracle reports builder

Is there a way to use a bind parameter inside a lexical parameter query something like this?:
select col from tbl where col = :bind_param
note: the code above is an input in a lexical parameter
When saying a "lexical query", do you mean a "lexical parameter"?
If I understood you correctly, then yes - you can do that, by setting it in the After Parameter Form trigger. (BTW, that's where I set my lexical parameters' values, always).
Open Reports Online Help System and search for "lexical". It is very well described. I believe that this is what you are asking:
A lexical reference cannot be used to create additional bind variables
after the After Form trigger fires. For example, suppose you have a
query like the following (note that the WHERE clause is replaced by a
lexical reference):
SELECT ENAME, SAL FROM EMP
&where_clause
If the value of the where_clause parameter contains a reference to a
bind variable, you must specify the value in the After Form trigger or
earlier (*LF). You would get an error if you supplied the following value
for the parameter in the Before Report trigger:
WHERE SAL = :new_bind
If you supplied this same value in the After Form trigger, the report
would run.
(*LF) Now, that's somewhat contradictory - "or earlier" actually is the Before Report trigger, so ... take it with caution. As I've said (and I'll repeat it): I set lexical parameters' values in the After Parameter Form. Worked always (for me).

what if i donot specify default in decode in informatica

If i don't specify value of default in informatica,what will it consider for default then?
My basic question is
Do both statement work same
DECODE(abc,'XYZ','XZ','OYE','KYA')
DECODE(abc,'XYZ','XZ','OYE','KYA',abc)
Return Value of DECODE
1.First_result if the search finds a matching value.
2.Default value if the search does not find a matching value.
3.NULL if you omit the default argument and the search does not find a matching value.
4. Even if multiple conditions are met, the Data Integration Service returns the first matching result.
5.If the data contains multibyte characters and the DECODE expression compares string data, the return value depends on the code page and data movement mode of the Data Integration Service.
So, in your first statement - NULL will returned if there is no Match.
And in the second stament, it returns the column data if there is no Match

How to escape characters for dictionary key values in Robot Framework?

I am trying to assign value to a dictionary key but getting an error
"ValueError: Adding data to a dictionary failed. There should be even number of key-value-pairs."
Here is the code
set to dictionary ${cParamsDict} cust_params v=classifieds&cpage=browseads&article-id=65207
I believe the "=" in the value is causing issue. How do I resolve this? I have to pass this dictionary to a keyword for further verification
Set To Dictionary ${cParamsDict} cust_params v\=classifieds&cpage\=browseads&article-id\=65207
or
${value} Set Variable v=classifieds&cpage=browseads&article-id=65207
Set To Dictionary ${cParamsDict} cust_params ${value}
Docu: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-variables
Just to clarify - you've already created a dictionary using the Create Dictionary keyword (from Built-in)?
If so, then yes - likely as not your issue is not escaping embedded equals signs. Your line should read like this:
Set To Dictionary ${cParamsDict} cust_params=v\=classifieds&cpage\=browseads&article-id\=65207
Read up on escaping in the documentation.

Teradata: Is it possible to generate an identity column value without creating a record?

In Oracle, I used to use sequences to generate value for a table's unique identifier. In a stored procedure, I'd call sequencename.nextval and assign that value to a variable. After that, I'd use that variable for the procedure's insert statement and the procedure's out param so I could deliver the newly-generated ID to the .NET client.
I'd like to do the same thing with Teradata, but I am thinking the only way to accomplish this is to create a table that holds a value that is sequentially incremented. Ideally, however, I'd really like to be able to acquire the value that will be used for an identity column's next value without actually creating a new record in the database.
No, it is not possible with Teradata because Identify values are cached at either the parsing engine (PE) or AMP level based on the type of operation being performed. My understanding is that the DBC.IdCol table shows the next value that will be use to seed the next batch of IDENTITY values that are needed by the PE or AMP.
Another solution would be to avoid using IDENTITY in this manner for your UPI. You could always use the ROW_NUMBER() window aggregate function partitioned by your logical primary key to seed the next range of values for your surrogate key.

Resources