Evaluator column error with This PC

image

Getting an evaluator error with this Drive Total Size column for This PC. Seems to happen when format lock is on and another folder is navigated to.
(The columns that were locked in another folder do not show in This PC when navigated to, which is good, but when navigating away from This PC the columns from This PC are retained in the new folder - bug ?)

<?xml version="1.0"?>
<evalcolumn align="2" attrrefresh="no" autorefresh="no" customgrouping="no" foldertype="all" header="Drive Size" keyword="DriveTotalSize" maxstars="5" namerefresh="no" nocache="no" reversesort="no" supportmarkup="no" title="Drive Total Size" type="0">// column for total size of drive in TB or GB

tb = (1024 * 1024 * 1024 * 1024) as int64;
gb = (1024 * 1024 * 1024) as int64;
total_free = Val(&quot;sh:freespace&quot;) as int64;
total_used = Val(&quot;sh:usedspace&quot;) as int64;

total = (total_free + total_used) as int64;

if ( total &gt; 549755813888)
  return (Ceil(total / tb) + 1) as int + &quot; TB&quot;;
else
  {
    size = (Ceil(total / gb) + 1) as int;
    if 		(size &lt;= 1) 	return &quot;1 GB&quot;;
	elseif 	(size &lt;= 2) 	return &quot;2 GB&quot;;
	elseif 	(size &lt;= 4) 	return &quot;4 GB&quot;;
	elseif 	(size &lt;= 8) 	return &quot;8 GB&quot;;
	elseif 	(size &lt;= 16) 	return &quot;16 GB&quot;;
	elseif 	(size &lt;= 32) 	return &quot;32 GB&quot;;
	elseif 	(size &lt;= 64) 	return &quot;64 GB&quot;;
	elseif 	(size &lt;= 128) 	return &quot;128 GB&quot;;
	elseif 	(size &lt;= 256) 	return &quot;256 GB&quot;;
	else					return &quot;512 GB&quot;;
  }

</evalcolumn>

sh:freespace has been copied from
Keywords for Columns [Directory Opus Manual]

Is the error happening for a specific item in This PC, or all the drives there?

it is not happening in This PC
it happens when navigating to another folder.
The This PC folder format is retained because format lock is on, and from what I can tell it happens for all items in the folder being navigated to.

I think the evaluator column is trying to get sh:freespace from each item.

so the issue is, should the unique folder format for This PC (unique because it contains columns that are exclusive to This PC) be retained if folder format is locked and a different folder navigated to.
Usually with format lock off, this is not a problem as the This PC folder format will not be retained.

Perhaps,

  • if format lock on
  • if This PC navigated to (whilst format lock is on)
  • remember old format (navigating to This PC will change to This PC folder format if folder format is locked)
  • restore the remembered format if This PC navigated away from (and format lock still on)

Your Evaluator code should test if the value exists before using it, if it’s something that only exists in one folder. Nothing stops the column being turned on in other folders.

Many thanks, that is now working :slight_smile: