· Dec 20, 2021

Can you have a Parameterizable LOCATION for a %Stream.FileCharacterGzip property?

I want to make the LOCATION for a %Stream.FileCharacterGzip property we have in a class parameterisable (as in stored in a global), so it can be different for different customers. Is that possible?  I've tried doing it a few different ways:
Creating a parameter
Parameter STREAMLOC = {^websystem("auditstream-location")};
then I tried to reference that in the 

Property HTMLZIPDoc As %Stream.FileCharacterGzip(LOCATION = ..#STREAMLOC);

but the compiler doesn't like that. 

I've also tried adding something to %OnOpen and %OnNew:
Method %OnOpen() As %Status [ Private, ServerOnly = 1 ]
    S ..HTMLZIPDoc.%Location=^websystem("auditstream-ziplocation")
    Quit $$$OK

Method %OnNew() As %Status [ Private, ServerOnly = 1 ]
    S ..HTMLZIPDoc.%Location=^websystem("auditstream-ziplocation")
    Quit $$$OK

but that didn't work either. Is it possible?

Product version: Caché 2017.1
Discussion (4)1
Log in or sign up to continue


Thanks that did work when I took out the %OnOpen. What I was trying to do was copy from an existing %Stream.FileCharacter; property to a new  Stream.FileCharacterGzip property and I was also trying to set the location of the FileCharacter property too, but in doing that it lost the link the existing file, even though it was the same location. So I've just had to add code to change the location of the Stream.FileCharacterGzip just before I copy it from the existing property.  I did realise you could set the FileName but wanted it to just generate the random filename part as it does when you set the LOCATION, so wasn't sure how that would work when using that. 

Actually, it wasn't quite working. When I reopened the class it couldn't access the file property as it was looking at the default stream location rather than the one it was filed with, so thought it was empty!  It doesn't appear to save the directory along with the filename in the D global. So I'm having to do a workaround when I open the object I set a variable to the HTMLZIPDoc.Filename, piece out just the filename part then put the directory and a slash on the front and put it back into HTMLZIPDoc.Filename and that seems to work. If anyone has a better solution let me know. thanks.