Cannot set RowRendered ViewValue of null upload field

v2021.0.8I have 4 file upload fields in my table
I’m trying to use Row_Rendered event to display text in cases where the a file has not been uploaded yet.
Field type is varchar(255)My Row_Rendered code is like this.


if ($this->Review->CurrentValue == NULL){
	$this->Review->CellAttrs["class"] = "bg-danger text-white";
	$this->Review->ViewValue = "no file";
	}

The CellAttrs[“class”] is being correctly applied based on whether $this->Review->CurrentValue is null or not.
But my modified ViewValue is not being rendered at all.
I am however able to override the view value if the field is NOT NULL
I have also tried the same code above on a varchar(75) field in the same table which also contains a NULL value, and it works fine.It seems to only be an issue with NULL file upload field values.Can someone please try to replicate?

This is how I have itif (empty($this->Review->CurrentValue)){
$this->Review->CellAttrs[“class”] = “bg-danger text-white”;
$this->Review->ViewValue = “no file”;
}else{
$this->Review->CellAttrs[“class”] = “bg-success”;
$this->Review->ViewAttrs[“class”] = “btn btn-light btn-block text-white”;
$this->Review->ViewValue = “”.Language()->phrase(‘ClassAct_15’).“”;
}
var_dump($this->Review);

To check value of file upload field, you should use, e.g.

if (EmptyValue($this->Review->Upload->DbValue)) {
...
}

For now I have worked around this problem by setting a default value in the mysql table of ‘nofile’ for that field.It’s not an ideal solution as the text I’m dispalying still gets rendered as if its a link, but I’m working on removing the link styling via CSS class instead.Final solution in case anyone hits this issue:
set Review field’s default value in the MySql table to ‘nofile’, and update all current NULL records to this value.

$ReviewViewValue = $this->Review->ViewValue;
if ($this->Review->CurrentValue == 'nofile'){
		$this->Review->CellAttrs["class"] = "bg-danger text-white";
		$this->Review->ViewAttrs["class"] = "btn disabled";
		$this->Review->ViewValue = "<span style='color: white; text-decoration: none; '>No file uploaded"</span>";
    	}else{
		$this->Review->CellAttrs["class"] = "bg-success";
    		$this->Review->ViewAttrs["class"] = "btn btn-light btn-block text-white";
		$this->Review->ViewValue = "<a href='uploads/Projects/Reviews/".$ReviewViewValue."' target='_blank'>".Language()->phrase('Phrase_15')."</a>";
	}