Updating a Text List

How do we force a text list to update when scrolling through records?

I have a text list that displays files related to the current record. As I scroll through the db, the list updates if there are matches, but if nothing matches it retains the last displayed list, which is wrong.

In essence, this is the formula for the list:
listfiles(folder(FolderPath+"/"+RecordID),"")

I’ve tried catch error(.

I’ve added the RecordID to the formula and removed it again:
Arraylast(RecordID+"|"+listfiles(folder(FolderPath+"/"+ RecordID),""),"|")

So far nothing I’ve tried forces the list to refill when the result is empty. I would’ve turned to FillList in .Current Record in v6.

What are FolderPath and RecordID? Perhaps field names? If they are field names, then the list should update when moving to a different record.

What does “if nothing matches” mean? That there is no such folder? If there is no such folder, the result will be an error, and in that case, the text list won’t update.

I’m not sure why you are using the folder( function – perhaps just as a holdover from Panorama 6. It doesn’t hurt anything in this case, but it’s unnecessary.

I think the formula you are looking for is:

catcherror("",listfiles(FolderPath+"/"+RecordID))

(Note that the second parameter of listfiles( is also optional now in Panorama X, so I left it out.)

You mention that you tried catch error(, is that space a typo? There is no space in the catcherror( function name.

I’ve added the RecordID to the formula

In this case RecordID is already part directly of the formula, so this isn’t necessary. If it was necessary (for example if it was included in a formula that was quoted, which would make it “invisible” as far as record updating goes), the ignore( function is designed for this purpose. For example:

ignore(catcherror("",listfiles(FolderPath+"/"+RecordID)),RecordID)

However, this is not necessary in this situation.

That wouldn’t have worked either, because the error would have stopped the code and the list wouldn’t be filled. Basically exactly the results you’re getting now, for the same reason.

FolderPath is not the actual code, just a generic label used in this example. RecordID is a field name and I expected it would update, but it wasn’t if there was no such folder. I’ll have to try it with the obsolete function and parameter removed.

On catcherror( I did not have the space in the code. For one thing it shouldn’t compile. When writing about it later the space snuck in. I had not used ignore too so possibly that will also help.

Clearly worth noting, once I eliminated the folder( function it worked as expected.

After years of dealing with folder( and pathstr( in all sorts of scenarios, I had no reason to omit it or spot it as a flaw.

Interesting, I would not have expected that removing the folder( function would have made any difference. I just mentioned it because it makes the formula simpler, good thing I did mention it!