Re: Possible to use .TR5 file in TRIM APIs? (726 Views)
Reply
Occasional Collector
NathanielPayne
Posts: 2
Registered: ‎03-12-2012
Message 1 of 6 (734 Views)

Possible to use .TR5 file in TRIM APIs?

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.

Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 2 of 6 (731 Views)

Re: Possible to use .TR5 file in TRIM APIs?

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>


Cheers,
Erik
Occasional Collector
NathanielPayne
Posts: 2
Registered: ‎03-12-2012
Message 3 of 6 (728 Views)

Re: Possible to use .TR5 file in TRIM APIs?

Ah, so can the TRIM APIs access saved searches? Would it be easier to just have the program access a saved search as opposed to going the route of using a TR5 file middleman?

Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 4 of 6 (726 Views)

Re: Possible to use .TR5 file in TRIM APIs?

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.
Occasional Visitor
afdoss
Posts: 1
Registered: ‎05-28-2014
Message 5 of 6 (326 Views)

Re: Possible to use .TR5 file in TRIM APIs?

Would you be interested in sharing your code to do this? I am trying to do a similar thing but cannot work out how to do it.

Honored Contributor
EWillsey
Posts: 1,929
Registered: ‎04-20-2010
Message 6 of 6 (317 Views)

Re: Possible to use .TR5 file in TRIM APIs?

Sorry, can't give it away for free.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.