I have problem with CloudConnect application. I'm trying to write a transformation code in REFORMAT component, but there is a problem with if
function.
Maybe the problem is with =
, but I have no idea how to fix it.
function integer transform() {
$out.0.date = str2date($in.0.Date, "yyyy-MM-dd");
$out.0.price = str2decimal($in.0.Amount);
if ($in.0.Purpose = 'A') {return "Facebook";} else if ($in.0.Purpose = 'B') {return "Google Adwords";} else {return SKIP;};
return ALL;
}
Like in other programming languages, the single equal sign (=) is the assignment operator. That is,
$in.0.Purpose = 'A'
assigns the value 'A' to $in.0.Purpose variable. In your case, you need to use the comparison operator (==).