How to filter string value in an attribute in RapidMiner - rapidminer

I have an attribute called Age. Some values in the Age Attribute is not integer at all. For example, 12W, 30Lo, Giraffe. I want to filter out values that are not an integer.

If you have mixed values, you should use the "Parse Numbers" operator to correctly handle the integer values. This operator has a parameter unparsable value handling, set this to "replace with missing", so all non-integer values are set to missing values.
Afterwards, depending on your use case, you can simply continue your workflow or filter your examples to remove the examples with a missing value in the Age column.

Related

Pass a Parameter in SSRS while removing Dashes

I am passing a unique ID as parameter in SSRS report. In the source table, unique id does not contain dashed. However, the user may insert Unique ID including dashes "-" and in some cases without dashes. Is there a way that we could remove dashes from the parameter.
For example, unique id 3120-20268-8 is stored in table as 3120202688. How I could retrieve if user pass multiple values with or without dashes in the SSRS Report.
When is used below query, it gives record against single value only. However, gives error when more than one values are provided.
select * from Table
where Unique_ID in (REPLACE(#Unique_ID,'-',''))
For more than 1 values, it gives errors mentioned below:
The replace function requires 3 argument(s).
Query execution failed for dataset 'ATL_List'.
Thanks
One of the simplest mechanisms for this is to create an expression based parameter to hold the sanitised input. This parameter would be hidden so the user is not aware of it, but the rest of the usage of the parameter is the same.
NOTE: You could do something similar with a query based default value, but this case is easier to do via a simple expression
Single Value Parameter
Create a new parameter:
set it to hidden
Set the default value expression:
=Str(Parameters!inputID.Value).Replace("-","")
Multi-Value Parameter
This is only slightly trickier, in the expression we can join the selected values together into a CSV string, then process that value and then split it back:
Set the parameter to multi-value, but still hidden:
Set the default value expression:
=Join(Parameters!inputID.Value,",").Replace("-","").Split(",")
Without going to detailed, if we made the sanitised parameter temporarily visible, just to demonstrate the conversion, it should look like this:
The parameter MUST be hidden!
NOTE: DO NOT make your sanitised parameter visible as in the above screenshot in your deployed report! Doing so will mean that it will not pickup changes made to the input value after it has rendered the first time.
remember that we have exploited the default value, we haven't arbitrarily defined en expression to always execute.
The output when the parameter is hidden is calculated when the report is rendered, it's just harder to visualise the behavior in this static post:
In your DataSet query you would just use the sanitised parameter:
SELECT * FROM Table WHERE Unique_ID IN (#sanitisedMultiValue)
You should be able to use the replace function in your report to format the parameter value after it has been entered, something like the below
replace(Fields!Paramater.Value,"-","")=FieldinYourTable

Assigning values to numbers in a text string using sql in mysql

This is an example of a string inserted into a mysql db field after a multiple choice checkbox form field has been submitted. (including the brackets): [1,0,1]
1=box checked
When the first number in the string = 1 value = pie, when the second number in this string =1 value= cookies, when the third number in this string =1 value = fruit. So the output for this string would be cookies, fruit.
I need to assign values to these numbers in an sql query. Something like:
select answer_data
from answers
where if the first number in the string = 1, the value is pie; if the 2nd number in the string = 1, the value is cookies;if the third number in the string=1, the value is fruit;
Caveat: Storing the data in this implied mapping to an array definition is a very brittle design. A better approach would be to just store the actual text values as JSON.
However, if you must use that approach...
If you defined a stored procedure
https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html
You could use the Substring function to tease out the values - and assemble desired output
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring

Entry with NULL in combobox

I have a combobox that I use for filtering entries in the column below. The code reads the entries of the column and adds what it finds into the combobox (SELECT DISTINCT).
This works fine if the columns don't have entries that are NULL. If they do, a blank field will show in the combobox (which is good, I want to be able to filter for empty entries). However, if I click on this field in the combobox, all entries are shown, not just the NULL ones. Does anyone know why this could be? Does Access convert NULL to an empty string? If so, can I circumvent this somehow?
You are looking for the NZ function
Syntax
Nz ( variant [, valueifnull ] )
The Nz function syntax has these arguments:
variant
Required. A variable of data type Variant.
valueifnull
Optional (unless used in a query). A Variant that supplies a value to be returned if the variant argument is Null. This argument enables you to return a value other than zero or a zero-length string.
Note: If you use the Nz function in an expression in a query without using the valueifnull argument, the results will be a zero-length string in the fields that contain null values.
MS DOC:
https://support.office.com/en-ie/article/nz-function-8ef85549-cc9c-438b-860a-7fd9f4c69b6c

MS Access, Use Expression Builder to Compare Field in One Table to DLookup in Another Table

I'm trying to make a MS Access report, where I use a text box to display a field value, then have another text box indicating if the first value is higher or lower than an entry in a separate table.
The report has a record source of "Table 1", and a textbox named "txt_Value1" which displays the number in Field: "Value1". I have a second table, "Customer_Criteria" which has a field "PassValue" that I want to compare against. My expression builder statement is:
IIf([txt_Value1]<(DLookUp("[PassValue]","[Customer_Criteria]","[Customer] = 'ABC'")),"TRUE","FALSE")
This statement always returns false, regardless of what the correct logical result is.
I've tested it, writing:
IIf(1<(DLookUp("[PassValue]","[Customer_Criteria]","[Customer] = 'ABC'")),"TRUE","FALSE")
And I get the correct results. Also, if I write:
IIf([txt_Value1]< 1,"TRUE","FALSE")
I get the correct results. What am I missing to compare the textbox value vs. the Dlookup?
As I understand, both fields are numeric. Access may consider those fields as text, so for correct comparing use type conversion.
Try this:
IIf(CLng(Nz([txt_Value1],0))< _
CLng(Nz(DLookUp("[PassValue]","[Customer_Criteria]","[Customer] = 'ABC'"),0)), _
"TRUE","FALSE")
Nz required if fields may contain NULL values, in this case type conversion function will return error.

SSRS Count or Sum expression

I cannot work out why these Total expressions don't work...
I am trying to add any cells that have a date later than today, with any cells that have "Not Reqd", and then divide that by the number of rows, to get a percentage.
All I'm getting is #Error.
These are the expressions I've tried:
=SUM(IIf(Fields!Jetter_Trng.Value >Today OR
Fields!Jetter_Trng.Value = "Not Reqd",1,0)))/(Count(Fields!Jetter_Trng.Value)
and
=Count(IIf(Fields!Jetter_Trng.Value >Today OR
Fields!Jetter_Trng.Value = "Not Reqd",1,Nothing)))/(Count(Fields!Jetter_Trng.Value)
The "Not Reqd" string has come from an expression that changes a date (01/01/1950) to "Not Reqd". Maybe this is messing things up:
=iif(Fields!Jetter_Trng.Value = "01/01/1950", "Not Reqd", Fields!Jetter_Trng.Value)
The current working expression (not looking for "Not Reqd") is:
=COUNT(IIF(Fields!Jetter_Trng.Value>Today,1,Nothing)))/(Count(Fields!Name.Value))
I'm a bit lost...
A couple of notes on your expression as it stands at present
Jetter_Trng appears to be a string representing either a date or “Not Reqd”. You can’t compare strings to dates without casting them to a date type first using CDATE()
The number of braces (( and )) do not match
The root of your problem though is that you are using Jetter_Trng to return either a Date, or the value “Not Reqd”.
When SSRS attempts to evaluate an expression it does it all at the same time. It doesn’t follow a path to find the answer, and ignore other paths. Therefore, when you are attempting to compare
Fields!Jetter_Trng.Value >Today
This is comparing a string to a date, and throwing the error, as this mean nothing
"Not Reqd" > Today
You won’t be able to do all that you want to using only one Field of type string.
Your options are to
Use two fields – the date and a flag indicating not required, or
Use one field – but have an “invalid date” (01/01/2100 perhaps) that you could then treat as the “Not Reqd” value, and check if the current date is less than that (which it always will be)
Using the second option here you could then use the following expression to create the desired calculation
=sum(iif(CDate(Fields!Jetter_Trng.Value) > Today, 1, 0)) /
Count(Fields!Jetter_Trng.Value)
Which would evaluate this dataset as follows