Comparing two strings with Jasper inner function EXACT - jasper-reports

When I try to compare two values I have an error
ERROR PrintJasperService:338 - net.sf.jasperreports.engine.fill.JRExpressionEvalException:
Error evaluating expression for source text: //EXACT($P{id}, "14" ) ? "FLASH" :$P{name}
$P{id} I get out from an array: $P{map}.get("{id}")==null? " ":$P{map}.get("{id}")
So value of $P{id} can not be NULL.
The type of $P{id} is java.lang.String.
I tried compare with 'equals' but got the same error:
ERROR PrintJasperService:338 - net.sf.jasperreports.engine.fill.JRExpressionEvalException:
Error evaluating expression for source text: $P{id}.equals("14") ? "FLASH" :$P{name}
What I do wrong?

Declaring the parameter as java.lang.String would not convert the value to String, you'll need to make sure that the parameter expression evaluates to a String.
You can use something like this:
$P{map}.get("{id}")==null? " ":$P{map}.get("{id}").toString()

Related

Pass number function in azure pipeline dinamically

Trying to pass sum or multiply number to subtract from date dynamically in blue pipeline as below:
#concat(
'RANGE:',
1+((1-1)*(variables('totalcount')/20)),
':',
variables('totalcount'),
':50'
)
The above expression says Unrecognized expression: 1+((1-1)*(variables('totalcount')/20))
The math functions in Data Factory are add, mul, div, etc. You cannot use the *,+,/ literals. Here is the converted expression
#concat(
'RANGE:',
string(add(1,mul(sub(1,1),div(int(variables('totalcount')),20)))),
':',
variables('totalcount'),
':50'
)
which gives the result "RANGE:1:18000:50". You did not specify the expected result so don't know if that is what you want. The expression I changed will always result in a value of '1' because of the 1-1 part.

Issue with conversion from string to double

I am not able to convert my string to double.I am getting below error
conversion from string to double is not valid
I have tried below approach but all are giving me same error. I am using Assign activity in uipath with intvalue defined as double and row.Item("TaxResult") retrieves the value from excel
intval = Val(row.Item("Tax Result").ToString.Trim)
intVal = Double.Parse(row.Item("Tax Result").ToString.Trim , double)
intVal = cDbl(row.Item("Tax Result").ToString.Trim)
Out of the above three first one is returning to me 0 value while the below two is giving me an error
"conversion from string to double is not valid"
Tax Result column in excel stores the value like (5.2, 19.8, 98.87). I want to sum all these value as part of my requirement
First, you don't need the .Item after row, it should just be row("Tax Result")
Ideally you should use a Double.TryParse() to try and avoid any exceptions if it cant convert to Double.
This can be achieved using an If Statement as seen below, if the Try Parse is successful the string can be converted using Double.Parse(row("Tax Result").ToString.Trim) and on failure I have assigned intval to 0 but you could put handling here to handle if it can't convert the number

SSRS nested IIF/CStr explanation

Could someone let me know if the IIF statement below means output any value that starts with a 4 please?
=IIF(LEFT(CStr(Fields!CLOCK_NUMBER.Value),1)="4",Fields!JOB_NO.Value, "")
The short answer is yes.
Starting from the middle and working outwards this expression is doing the following..
Get the value of the field CLOCK_NUMBER
Convert this to a string (the CSTR function)
Take the 1st character (LEFT function with 1 as the seconds parameter)
If the equals "4" return the Value that is in JOB_NO
Otherwise return an empty string
If this is not working for some reason, try converting the job_no to a string before returning, that way you ensure you always return a string (in case JOB_NO is numeric). You can simply wrap the job_no in a CSTR like this CSTR(Fields!JOB_NO.Value)
Translates to..."try to" convert the field CLOCK_NUMBERS's native value to a string and take the LEFT(1) most significant digit(s) and if that value is "4" then return the JOB_NO Fields's value. else return empty string.
So, it is, if the first digit is 4 then return JOB_NO.

Scala: Start an identifier with a digit

I want to write an identifier which starts with a digit inside an enumeration but it gives 'Invalid literal number error'. Something like:
val 30Over360US = Value
How do I make it happen?
You can use almost any identifier with the help of backticks:
val `30Over360US` = Value

double to char matlab

I would like to have the following :
'This variable is pointer'
I have
a = get_param(....)
=>this gives me : pointer
know to have the string above I did :
strcat('This variable is',a)
but this gives me :
'This variable in pointer'
It's very difficult to work out what you are trying to do.
The current title 'double to char matlab' indicates you are trying to convert a double to a string (char?).
There are many functions that can do this in Matlab:
a=3.1;
num2str(a)
sprintf('The value is %g', a );
I'm not sure what you are trying to achieve with:
strcat('This variable is',a)
but the only way I can think of that you could actually get:
'This variable in pointer'
is if you had set a with something like:
a = sprintf('\bn pointer');
If a was set to 'pointer' then
strcat('This variable is',a)
would result in:
'This variable ispointer'
Even if you added a space after is you would get the same result because strcat trims whitespace before concatenating.
You'd be better off using :
['This variable is ' a]
to concatenate the 2 strings.