The Keyword then is missing Crystal reports - crystal-reports

I am getting an error The Keyword then is missing in my code, I cannot find why it is giving me the error. The error cursor is after the "Various" Any ideas
IF (isnull({148_vwWorksOrderReportFeed.Expr6})) OR IF (isnull ({WorksOrderHeader.udfCustomer})) OR IF (({WorksOrderHeader.udfCustomerVarious})) = False Then "Stock" Else IF not isnull({148_vwWorksOrderReportFeed.Expr6}) THEN {148_vwWorksOrderReportFeed.Expr6} Else IF not isNull({WorksOrderHeader.udfCustomer}) THEN {WorksOrderHeader.udfCustomer} Else If {WorksOrderHeader.udfCustomerVarious} = True THEN "Various"
I have tried various syntax and googled the life out of it but cannot find anything to explain why it is happening, could be my lack of knowledge in stsntax of course.

Try the following:
IF (isnull({148_vwWorksOrderReportFeed.Expr6})) OR (isnull ({WorksOrderHeader.udfCustomer})) OR ({WorksOrderHeader.udfCustomerVarious} = False) Then "Stock" Else IF not isnull({148_vwWorksOrderReportFeed.Expr6}) THEN {148_vwWorksOrderReportFeed.Expr6} Else IF not isNull({WorksOrderHeader.udfCustomer}) THEN {WorksOrderHeader.udfCustomer} Else If {WorksOrderHeader.udfCustomerVarious} = True THEN "Various"

Related

Is therre any crystal coding style to prevent nil error in compiling

I am a newbie of crystal and amber framework, and when I try to rewrite a rails app with db to amber, I encountered a lot of compile error complained about nil matching, even sometime it is clearly not nil I think, such as
doc = Document.first("where id = ?",params[:id])
if doc.title.nil?
title = ""
else
title = doc.title
end
I must write as such
doc = Document.first("where id = ?",params[:id])
title = ""
if doc
if doc.title.nil?
title = ""
else
title = doc.title.not_nil!
end
end
I think maybe it is because of my code style.
So is there some good code style document for crystal or
good practices?
I'm new to crystal too however, you can remove the nested if block with a guard clause.
return unless doc
Also, you can set a default value with granite. So where you put title = "" can be removed if the default value is an empty string. With that in mind, you new code would be:
doc = Document.first("where id = ?",params[:id])
return unless doc
title = doc.title

The keyword 'then' is missing

{FUELDELAY.STATUS} = "VENDOR RESPONSIBLE" and {FUELDELAY.FLIGHTDATE} in {?begtime1} to {?endtime1}
and if {?fuelserviceprovider} != "" then {FUELDELAY.FUELSERVICEPROVIDER} in {?fuelserviceprovider}
and if {?station} != "" then {FUELDELAY.STATION} in {?station}
I don't see the syntax error, but Crystal Reports keeps telling me that "The keyword 'then' is missing."
Do any of y'all see the error?
Any help is much appreciated--thanks!
You can try the following:
IF {FUELDELAY.STATUS} = "VENDOR RESPONSIBLE"
AND {FUELDELAY.FLIGHTDATE} in {?begtime1} to {?endtime1}
AND {?fuelserviceprovider} != ""
AND {FUELDELAY.FUELSERVICEPROVIDER} in {?fuelserviceprovider}
AND {?station} != ""
AND {FUELDELAY.STATION} in {?station}
THEN
//some code if true
ELSE
//some code if false
There are at least two main errors in your syntax.
The !=-operator is not valid Crystal-Syntax -> use the not-operator or <>-operator instead
and if ... is not valid. The syntax is as follows (The else-part is optional):
if <condition> then
'Do something
else
'Do something different
So the following formula should work.
I'm not sure if this is exactly what you need, because it's not clear from the question.
if
{FUELDELAY.STATUS} = "VENDOR RESPONSIBLE" and
{FUELDELAY.FLIGHTDATE} in {?begtime1} to {?endtime1}
and {?fuelserviceprovider} <> "" then
{FUELDELAY.FUELSERVICEPROVIDER} in {?fuelserviceprovider}
else if {?station} <> "" then
{FUELDELAY.STATION} in {?station}

Why breakpoint breaks at else block in 'if else' condition

I am trying to figure out, why, if I put breakpoints on if and on else line, why my if else {} condition breaks on else if the condition was true in if block?
I am using realm but I do not think, that is an issue.
//Check if Object already exists in database
if !RealmService.shared.ifPortfolioExists(name: portfolio.name){//Breakpoint on this line which is true
//Create portfolio
RealmService.shared.create(portfolio)
//Assign portfolio to transaction
transaction.portfolio = portfolio
//Create transaction
RealmService.shared.create(transaction)
}else{//Breakpoint on this line
//Assign portfolio to transaction
transaction.portfolio = portfolio
//Create transaction
RealmService.shared.create(transaction)
}
Am I working out of my mind or am I just stupid? Can please someone explain me this.
The compiler reads them to see if it should proceed into the following block of code. A breakpoint inside of the if will trigger when true and else when false
Do this to better understand where your breakpoints take effect:
if x != y {
print("if breakpoint")//set breakpoint here
} else {
print("else breakpoint")//set breakpoint here
// you should see that the breakpoint doesn't fire here
}

MonoDevelop "else if" broken indentation

I'm using MonoDevelop-Unity 5.9.6.
I have created a custom policy, which mostly works.
There's one problem which despite multiple attempts I haven't been able to fix.
"else if" clauses have a completely broken indentation, as shown here:
broken else if indentation
if ( Input.GetButton( "Left" ) )
{
_nextDir = Direction.Left;
}
else if ( Input.GetButton( "Right" ) )
{
_nextDir = Direction.Right;
}
else if ( Input.GetButton( "Up" ) )
{
_nextDir = Direction.Up;
}
else if ( Input.GetButton( "Down" ) )
{
_nextDir = Direction.Down;
}
else
{
;
}
return false;
What could be causing it?
I don't think anyone would ever want to indent this way, so I assume it's either a bug or some settings that don't go well together, and if it's the latter, I hope someone will be able to point me out in the right direction.
I guess MonoDevelop sees the else if statement as an if statement embedded in an else statement. So, if you have turned off the Align Embedded Statements option in your policy, you'll be getting some weird indentations. Just turn it back on and you'll have your code formatted the way you like it.

Set item email field in Podio

I'm having a hard time trying to guess how to set the item email field value, since there is nothing about this in the documentation (http://podio.github.io/podio-php/fields/)
I have tried :
$item->fields['email']->values = array("type"=>"work","value"=>"a#a.com");
$item->fields['email']->values = array("value"=>"a#a.com");
$item->fields['email']->values = "a#a.com";
$item->fields[$field_id]->value ="i#i.com";
$item->fields[$field_id]->type ="work";
$item->save();
Nothing works, please help! Thank you!
I have figured it out , here is the code that works (if anyone runs into the same problem)
$field_id = 'email';
$emails=$item->fields[$field_id]->values;
$item->fields[$field_id]->values =array('value'=>"i#oooo.com",'type'=>'work');
$item->save();