How do I format the following if/else in Jasper? - if-statement

I am trying to format the following if/else in Jasper and having trouble. This is what I have but my syntax is wrong can someone help?
$F{PAYMENT_METHOD_DATA} == {"deposit_name":"PayNearMe","is_important":true,"logo":"https:\/\/nj-cdn-casino.ballyinteractive.com\/cms\/V3\/Deposit-Methods\/icon-Paynearme.png"} ? "PayNearMe" :
$F{PAYMENT_METHOD_DATA} == {"deposit_name":"ACH (Optimal)","withdrawal_name":"ACH (Optimal)","display_order":"101","is_important":true} ? "ACH" :
$F{PAYMENT_METHOD_DATA} == {"deposit_name":"wire transfer","withdrawal_name":"wire transfer","display_order":"42","is_important":true} ? "Wire Transfer" :
$F{PAYMENT_METHOD_DATA} == {"deposit_name":"Personal check","withdrawal_name":"Personal check","display_order":"6","is_important":true} ? "Personal Check" :
$F{PAYMENT_METHOD_DATA} == {"deposit_name":"Cashier''s check","withdrawal_name":"Cashier''s check","display_order":"7","is_important":true} ? "Cashiers Check": "Cash"

Ternary operator should be like
condition ? execute true code : execute false code
jasper condition should be like,
$F{PAYMENT_METHOD_DATA} == "deposit_name"?"PayNearMe":"PayMe"
if you want to check multiple conditions, then you should write like,
$F{PAYMENT_METHOD_DATA} == "deposit_name"?($F{PAYMENT_METHOD_DATA} == "deposit_name_other"?"PayNearMeYes":"PayMeYes"):"PayMe"

Related

IF condition is getting failed ..solution plz

eval if (success == 'Data1') karate.call('test.feature')
this is getting failed displaying error message as
Expected ; but found { }
Tried below :
eval if (success == 'Data1') karate.call('test.feature');
Changing your step to below would work
* eval (success == 'Data1') ? karate.call('test.feature') : karate.call('fail.feature')

What does MOZ_ASSERT(static_cast<> == reinterpret_cast<>) do?

I saw a bunch of code in Firefox written like static_cast<>(obj) == reinterpret_cast<>(obj); anyone could help here for why the developers writing so?
bool
Wrap(JSContext* aCx, mozilla::dom::LegacyMozTCPSocket* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
{
MOZ_ASSERT(static_cast<mozilla::dom::LegacyMozTCPSocket*>(aObject) ==
reinterpret_cast<mozilla::dom::LegacyMozTCPSocket*>(aObject),
"Multiple inheritance for mozilla::dom::LegacyMozTCPSocket is broken.");
...
}

If statement not going to else statement in Katalon Studio for Android

I am using Katalon for Android Testing. I want it to click ImageView3 if it is present. If not, it will click ImageView2 (which makes ImageView3 appear later).
I have tried verifyElementVisible and verifyElementNotVisible. Also tried adding the if statement as 'if (Mobile.verifyElementVisible(findTestObject('Objects/android.widget.ImageView3'), 0) == true)' but this produced the same error.
Mobile.tap(findTestObject('Objects/android.widget.ImageView1'), 0)
if (Mobile.verifyElementVisible(findTestObject('Objects/android.widget.ImageView3'), 0))
{
Mobile.verifyElementVisible(findTestObject('Objects/android.widget.ImageView3'), 0)
Mobile.tap(findTestObject('Objects/android.widget.ImageView3'), 0)
Mobile.closeApplication()
} else
{
Mobile.tap(findTestObject('Objects/android.widget.ImageView2'), 30)
Mobile.verifyElementVisible(findTestObject('Objects/android.widget.ImageView3'), 0)
Mobile.tap(findTestObject('Objects/android.widget.ImageView3'), 0)
Mobile.closeApplication()
}
The error in the log is showing the following:
Reason: com.kms.katalon.core.exception.StepFailedException: Element 'Object Repository/Objects/android.widget.ImageView3' not found at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
As ImageView3 was not found, I would expect it to jump to the else statement. Any suggestion why this is not happening?
The FailureHandling was not set. It would throw an error as this was not set.
Added FailureHandling.OPTIONAL to the if statement
if (Mobile.verifyElementVisible(findTestObject('Objects/android.widget.ImageView3'), 0, FailureHandling.OPTIONAL))

kendo if else when null

I would like to have a template that always shows what is in odata table except null values, for example, in this example, I tried to make a condition which will check if UnitOfMeasure is null, if it is, it should display only Quantity value, if it is not, Quantity+UnitOfMeasure. Here is what I tried. Thanks
template: "#if(UnitOfMeasure == null) {#= kendo.toString(Quantity, "n2")#} else{#= kendo.toString(Quantity, "n2")# #=UnitOfMeasure#}#"
template: "#=kendo.toString(Quantity, 'n2')##=UnitOfMeasure == null ? '' : UnitOfMeasure#"

Faulting application name issue with application

I have a code like shown below
if ((client == NULL) || (client->type == Leave_Agent)) {
but when i changed it with following code i am getting errors in event logs
the modified code is shown below
if (((client == NULL)|| (client->type == Leave_Agent)) && (client->type == 0)) {
errors in event log is
Faulting application name: test.exe, version: 8.0.16.0, time stamp: 0x5036427e
Can any body guide me how to fix this, which stopping my application.The && operator will make any issues in c++ ?
if (((agent == NULL)|| (agent->type == SPUES_ntAgent)) && (agent->type == 0))
If agent is NULL then the left side of && will always be true and agent->type will always be accessed. So a NULL agent ensures a NULL dereference.
You should change your code to ensure it only gets dereferenced if it's not NULL.
I think you wanted to move the () around so that you never dereference the pointer if it's NULL:
if ((agent == NULL)|| ((agent->type == SPUES_ntAgent) && (agent->type == 0))) {
The problem is that you can reach this
agent->type == 0
when agent==NULL.
I cannot comment on how to fix without knowing what behaviour you expect. At the very least you should make sure agent is not dereferenced if it is ==NULL.