Select to view content in your preferred language

Unselected Records returning Null for field

279
5
03-11-2025 11:10 AM
JeffreyHinderliter
Emerging Contributor
if ($record.size != null && $record.material != null && $record.verifdate ==null)  
$record.survey_date
 
The above expression is used within a calculate field parameter.  My test data set has 16 records where all 16 records have the size and material populated.  6 of the 16 records have a verifdate populated so they are not null.  The expression is looking for records where size and material is populated but the verifdate is not populated so the date can be updated from a joined S123 table.
 
When I run or preview the DP, the calculate does populate the date for the 10 fields where verfidate is null, but it is changing the 6 fields with existing dates to Null.  Those 6 fields are not in the selection criteria.  
 
Thoughts? Thanks
Tags (3)
0 Kudos
5 Replies
AustinAverill
Frequent Contributor

From what you have copied and pasted, it appears your syntax for Arcade isn't correct... At a minimum you need to add curly brackets after your condition and then add a `return` so that the value is returned. The code as you pasted it would not return a value.

if ($record.size != null && $record.material != null && $record.verifdate ==null){
    return $record.survey_date
}

 

0 Kudos
JeffreyHinderliter
Emerging Contributor

It does return a value, although not entirely correct. I will try what you suggested. Thanks!

0 Kudos
JeffreyHinderliter
Emerging Contributor

Austin, made that change but still have the same results.  

0 Kudos
KenBuja
MVP Esteemed Contributor

You need the return, but when the if statement only has one line, you don't need brackets. This would work perfectly fine

if ($record.size != null && $record.material != null && $record.verifdate == null) return $record.survey_date;
0 Kudos
KenBuja
MVP Esteemed Contributor

For the records where verifdat is populated, do you just want to keep that date? Give this a try

When(
  $record.size != null && $record.material != null && $record.verifdate == null, $record.survey_date, 
  $record.verifdate
);