Question
· Apr 11, 2022

I need to add a sting to the end of another string in a business process using object script, I have a string being sent to the Business Process and I need to add the string to just the end.

I have a Business Service that reads a file from a folder and sends it as a string to a Business Process. In the business process, I need to add a string to the end of the file string that is coming into the Business Process. I am trying to do this in object script in studio and I am struggling to figure out how to add the string to the end of the other string. I am still new to studio and object script I have been reading up on the documentation and I am not sure what is the best way to accomplish this.

Any help would be greatly appreciated. And I would be happy to answer any question you have. 

Product version: HealthShare 2017.2
Discussion (6)0
Log in or sign up to continue

A few questions that will help us to understand better:
- Which business service are you using? Is it custom or out-of-the-box?
- If the service is custom, what type of object is it sending to the Business Process?
- What type of Business Process are you using? Is it BPL, ObjectScript, or a router using routing rules?

To help you, help us to help you. This means, show us what you have you already done. So we can you point in the right direction, maybe explain, why your solution dosn't work, etc. It's nothing bad to ask for help. At some point in the time we all were new to Studio and ObjecScript.

Just asking for a solution is like going home from the school and letting the parents make the homework...

So what have you tryed?

I have tried to reply to both of your posts individually, but unfortunately, the website does not seem to be working for me when I try to so here are my replies, Thank you again.

Marc Mundt

Thank you for asking I could have explained it better.

I am using the EnsLib.File.PassthroughService, to my understanding this service reads a file in its entirety and then converts it to a string and sends it through the production to a Business process. This process needs to take the string from the BS and concatenate a second string to the end of it. from there the Process needs to send it to an Operation. I am trying to write this in Object script, but I am having a hard time creating the BP from scratch, I have tried to read the documentation but I do not fully understand how to create a BP in just Object Script. 

I created a new Project in studio and selected Business Process, It automatically created the OnRequest Method and so I read up on that and I believe that that is the correct method I need to use. But I am not sure how to call the BS string into the Process. 

I hope this helps a bit. 

Julius Kavay 

Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
                Set EndMarker = "End Of File"
                Set IncomingString = ##class(ProofOfConcept.bs.SendFile).%New()
               
                Set Response = IncomingString _ EndMarker 

                Quit $$$ERROR($$$NotImplemented)
}

This is what I have tried, I created a new project in studio and selected the Business Process, it selected the OnRequest Method for me. I read up on it and it seems like it should work for me. But what I do not understand is how to: 
- call the Business Service string that I am expecting to get from the BS? 
- Once I have the string How can I send it to a Business operation? 

I know this may not look like much but I am having a hard time finding documentation how to create a BP from scratch. 

The PassthroughService will place the file contents in a stream, insert that stream into an Ens.StreamContainer object and send that to the Business Process. So Ens.StreamContainer, and the stream that it contains, is what your Business Process code will need to work with.

See this page for information on working with streams. Streams are different than simple strings and require using stream-specific methods for reading and writing content into the stream.

Unless you have a specific reason to write your business process in ObjectScript, I would recommend that you create a BPL-based business process using the visual BPL editor. There are more details here on creating business processes.

Absolutely. You can do this with two assign actions:

First assign action moves the stream pointer to the end of the stream content:

The second assign action writes our new content to the end of the stream:

And an extra note of explanation: what we're actually doing with these assigns is calling a method in the request class, which returns a status code, and assigning that status code to a temporary variable. It would be best to check this status code to see if there was an error, but I haven't added that here to keep things simple.