Hi Tuomo:
This is might be one for Chris as I had to do a lot of searching to find anything even searching the code for “getFullFileName” only turned up a jexlscript script at:
https://erddap.github.io/docs/dokka/-e-r-d-d-a-p/com.cohort.util/-script-row
However, even were this can be used (more on this below) I believe what would be used is:
<sourceName>=row.fileName</sourceName>
or:
<sourceName>=row.fullFileName</sourceName>
No parentheses, no "get" prefix — treat it as a property, not a function call. however, when i look at the EDDTableFromFileNames skeleton at:
https://erddap.github.io/docs/server-admin/datasets?_highlight=eddtablefromfilenames#eddtablefromfilenames-skeleton-xml
I don’t see that as an option. Not being certain of this myself, I asked Claude which said:
> EDDTableFromFileNames doesn't read inside files at all
> For this dataset type, ERDDAP isn't opening each file and extracting a row of data from its contents — it's just cataloging directory entries. The "rows" ARE the files. The native source columns for this dataset type are exactly: url, name, lastModified, and size — nothing else, because there's no file content being parsed.
> That's almost certainly why row.getFileName() (or the property-corrected row.fileName) came up blank: fileName/fullFileName in ScriptRow are meant for dataset types that actually open and read a source data file per row (EDDTableFromNcFiles, EDDTableFromMultidimNcFiles, EDDTableFromAsciiFiles, etc.) so the script can tag each output row with which underlying file it came from. In EDDTableFromFileNames, there is no "file being read to produce this row" in that sense — the file's name is already the data — so that ScriptRow property likely has nothing populated to return.
>
> The actual fix
> No script needed. Just declare name as a native sourceName:
>
> <dataVariable>
> <sourceName>name</sourceName>
> <destinationName>row_FileName</destinationName>
> <dataType>String</dataType>
> <addAttributes>
> <att name="ioos_category">Identifier</att>
> <att name="long_name">ERDDAP source filename</att>
> </addAttributes>
> </dataVariable>
>
> And if the admin wants the full path rather than just the bare filename, use url instead:
>
> <sourceName>url</sourceName>
>
Of course, if this is correct I will take the credit, if wrong blame Claude. But seriously at:
https://erddap.github.io/docs/server-admin/dataset-examples/video-datasets
you can see an example of creating a EDDTableFromFileNames and you see:
<dataVariable>
<sourceName>url</sourceName>
<destinationName>url</destinationName>
<dataType>String</dataType>
<!-- sourceAttributes>
<att name="ioos_category">Identifier</att>
<att name="long_name">URL</att>
</sourceAttributes -->
<addAttributes>
</addAttributes>
</dataVariable>
<dataVariable>
<sourceName>name</sourceName>
<destinationName>name</destinationName>
<dataType>String</dataType>
<!-- sourceAttributes>
<att name="ioos_category">Identifier</att>
<att name="long_name">File Name</att>
</sourceAttributes -->
<addAttributes>
</addAttributes>
</dataVariable>
and that successfully created a dataset with the filenames:
https://coastwatch.pfeg.noaa.gov/erddap/tabledap/fed_HAGE_VisualSurvey.html
HTH, and let me know if this fixes things.
-Roy
> --
> You received this message because you are subscribed to the Google Groups "ERDDAP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
erddap+un...@googlegroups.com.
> To view this discussion, visit
https://groups.google.com/d/msgid/erddap/b7339706-fe16-45e1-b08a-47b53ce03952n%40googlegroups.com.