The below one works fine
$Result += New-Object PSObject -Property @{
ServerName = $ServerName
Status = GetStatusCode( $pingStatus.StatusCode )
MapiDB=$MapiData | % {if ($_.Database -ne $null) {"Db="+$_.Database} ,$_.Result,$_.LatencyMS}
Whn I change to below getting error
MapiDB=$MapiData | % {if ($_.Database -ne $null) {"Db="+$_.Database} , if($_.Result -ne $null) {"Rslt="+$_.Result},$_.LatencyMS}
Missing expression after unary operator ','.
At C:\temp\Report\Report08.PS1:340 char:73
+ MapiDB=$MapiData | % {if ($_.Database -ne $null) {"Db="+$_.Database} , <<<< if($_.Result -ne $null) {"Rslt="
+$_.Result},$_.LatencyMS}
+ CategoryInfo : ParserError: (,:String) [], ParseException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator