what if i donot specify default in decode in informatica - decode

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

Related

Not able to save multiple values in a column of SQLite

I have a drop down in form that allow users to select multiple value at the same time in R Shiny and saving the record in SQLite DB at the back end and data type is VARCHAR
dropDown:
But when i click on save button i am getting below error:
Error in : Expecting a single string value: [type=character; extent=2].
Any help would be appreciated! :)
The error tells you all you need to know. Your selectInput is returning a vector of characters. Your database is expecting a scalar character. So, either turn the value of the selectInput into a scalar (by concatenation or pasting) or modify your database so that it can accept multiple rows of data which correspond to your input. The choice is yours.
I can't tell you which is more appropriate because you've provided no context.

SQLite C API equivalent to typeof(col)

I want to detect column data types of any SELECT query in SQLite.
In the C API, there is const char *sqlite3_column_decltype(sqlite3_stmt*,int) for this purpose. But that only works for columns in a real table. Expressions, such as LOWER('ABC'), or columns from queries like PRAGMA foreign_key_list("mytable"), always return null here.
I know there is also typeof(col), but I don't have control over the fired SQL, so I need a way to extract the data type out of the prepared statement.
You're looking for sqlite3_column_type():
The sqlite3_column_type() routine returns the datatype code for the initial data type of the result column. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. The return value of sqlite3_column_type() can be used to decide which of the first six interface should be used to extract the column value.
And remember that in sqlite, type is for the most part associated with value, not column - different rows can have different types stored in the same column.

Parsing nested JSON data within a Kusto column

After parsing the JSON data in a column within my Kusto Cluster using parse_json, I'm noticing there is still more data in JSON format nested within the resulting projected value. I need to access that information and make every piece of the JSON data its own column.
I've attempted to follow the answer from this SO post (Parsing json in kusto query) but haven't been successful in getting the syntax correct.
myTable
| project
Time,
myColumnParsedJSON = parse_json(column)
| project myColumnParsedNestedJSON = parse_json(myColumnParsedJSON.nestedJSONDataKey)
I expect the results to be projected columns, each named as each of the keys, with their respective values displayed in one row record.
please see the note at the bottom of this doc:
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. In such cases, it is not only necessary to invoke parse_json twice, but also to make sure that in the second call, tostring will be used. Otherwise, the second call to parse_json will simply pass-on the input to the output as-is, because its declared type is dynamic
once you're able to get parse_json to properly have your payload parsed, you could use the bag_unpack plugin (doc) in order to achieve this requirement you mentioned:
I expect the results to be projected columns, each named as each of the keys, with their respective values displayed in one row record.

How to assert that an array contains an element that matches an expected regexp?

I am trying to assert that an array contains at least one element that matches an expected regular expression, and I am trying to do it in the most by-the-book and the least reinventing-the-wheel way possible.
Ideally I would like to ->assertThat($actualArray, $someConstraintObject), where $someConstraintObject is a PHPUnit\Framework\Constraint\Constraint instance that does the RightThing™, and is only composed from constraints that ship with PHPUnit, without having to write a new constraint class.
One thing I considered which cannot possibly work: a LogicalOr constraint made of RegularExpression constraints. Why can't it work? Because RegularExpression constraint cannot "bind" an expected value; it can only be evaluated for an expected value, and I still have no way of "spreading" the values in an array over that constraint with "or" logic. A LogicalOr of RegularExpressions would allow me to check one actual value against multiple regular expressions, but it won't allow me to check multiple actual values against one regular expression.
How do I?

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()

Resources