I've got a situation that I was wondering if anyone has ever encountered and resolved. Right now, we've got a TRIM API-based program that runs nightly and queries the system and exports various documents out to a file location for viewing by company distributors. Right now the program is hard-coded to run specific searches, but we want it to be more flexible so that some of our users can better manage what gets searched and exported. I was thinking that this could be done by using .TR5 files. I have a user create a .TR5 file based on a saved search criteria, and I was thinking the program might be able to open the .TR5 file and use it to perform the search. Has anyone ever done anything like this before? I was thinking it was possible for the APIs to utilitze .TR5 files, but I can't find any info on it in the TRIM SDK. Would love assistance if anyone has dealt with things like this before.
The TRIM API doesn't have any method for accessing the contents of a TR5 automatically. The TRIM client itself just reads the contents and shows whatever should be displayed (whether it be an individual record or results of a search).
you could replicate the same behavior in your code. Just open the TR5 and process the contents.
If it's a saved search the contents will include: Type=38 TypeName=Saved Search Items=x [Item1] URI=<uri> Details=<savedsearchname> Extra=<descrpition>
If the TR5 just contains records the contents will include: Type=6 TypeName=Record Items=x [Item1] URI=<uri> Details=<recordNumber> Extra=<title>
Yeah you could do that, but how would you handle what the saved search is returning?
It would probably be easier for you if you added an additional field called "Distributor available" or something. Maybe use a thesaurus term instead? Your nightly routine would look for the anything with the additional field set or the thesaurus term, then export it. Then you don't have to deal with a complicate process for your users to get things exported.
I've done the same thing in the past and it worked well. The other option would to define an action called "Export", then your code just looks for anything with that action on it, and then exports it. With the action route you only ever have to deal with exporting it once.