Still a beginner here learning to use SOQL and I am not sure why this is returning nothing. I start off with using a txt file as a static resource and reading its contents which in my case are report names, one in each line. I then use the line variable in my query line by binding it in order to retrieve report ID and folder name.
I run it through the loop and I can confirm that the line variable is indeed getting each individual line in the txt file. But when I check the output, all it returns is ()
each iteration.
// sr is where I store the contents of a txt file that has report names
StaticResource sr = [select body from StaticResource Where Name = 'test'];
String contents = sr.body.toString();
for(String line : contents.split('\n')) {
// Get the report ID and folderName
List <Report> reportInfo = [SELECT ID, FolderName FROM Report where Name = :line];
System.debug(reportInfo);
}
Any help is appreciated. Thanks.
line
you're working with in each iteration (viaSystem.debug()
) to see if there's anything obviously wrong. It does appear thatbody
is base64 encoded, so it's possible (likely, even) that not decoding from base64 could be the issue.