PHP at Bloomberg's - 4

Part four, requesting data (this post)

In the last post (which I hoped to be the last) in the series PHP at Bloomberg’s I described how you fetch a result with a responseId after you have requested information from Bloomberg’s.
Having shown the ‘retrieve app’ for the business owner I was asked “Can’t you request an information set in one shot mode, and then retrieve the result”. “Why do you want to do that? We schedule a request periodically at Bloomberg and then we just retrieve the result when time is due and have ever green data. Schedule once fetch fresh data forever” I responded. “Schedule periodically at Bloomberg has contractual implications. We like to be able to schedule ourselves. We like the abillity to request "one shot" or “ad hoc” reports then fetch the result, and schedule this daily. We know this is more cumbersome, but can you have try?”  
Easy I thought, first I create a job to send the request to Bloomberg and then wait for the report to be produced:
Then I had to modify the PHP code from the previous post a bit. In the original code I create the parameter list directly in the PHP code as it is just a one liner:

But here the parameter list is hundreds of lines. I decided to specify the list as plain XML text following Bloomberg SOAP standard, (you see it above in the <soaprequest> tag). And add code to convert it to an array:

I added a <top> node making the XML well formed and via JSON encode/decode created a perfect array for the soap request.
Then I just run the job and after a few tries it worked. This was easy, unfortunately it turned out to not be as easy with the scheduling. Right now I’m thinking about how to solve the scheduling, but there are some twists to it that I don’t get my head around. When the scheduling is done I might write yet another post about PHP at Bloomberg’s.


Den Bock zum gärtner machen

Some while ago the company decided to make the goat the gardener, so they put me in charge of group codes, not only the application managing the codes (which I agreed to), but also the codes themselves. I told all and everyone I’m not qualified to do that and all and everyone agreed. The codes are serious business e.g. we have a number of codes to classify our products to keep track of what we sell and analysing marketing trends etc. We have number ranges for parts. If these codes are messed up the consequences may be dire. I take the codes dead serious, that’s why I said “I’m not qualified” in the first place. Some may think it is easy to hand out and keep track of codes you only have to be careful, accurate and meticulous. It’s easy to say, but if you are the antithesis of those traits it is very very hard to keep accurate records of things. If you add to that inability to correctly repeat manual tasks and periods of indolence, it is difficult. (That’s why I became a programmer not a keeper of records.)

I was assured “You do not have to keep track of the codes, the responsibility sits in the business. This is a self service application.” And sure as hell the first thing happend “Hi Lars, I’m Riccardo responsible for new spareparts at the Milano Factory, I need new spare part numbers, can you help?”
“Well you know, you are supposed to do that yourself, frankly I do not know how to do it” I responded.
“I’m told you are the expert and this is a matter of urgency we need those numbers now, please”.
After an hour I had figured out how to assign spare part numbers to Riccardo.
Riccardo was just the first, almost every day I get new requests which I forget about or put at the bottom of my pile of tasks to do. It takes me hours to do these tasks, which in the hands of a capable keeper of records would have been expedited in minutes, what they do swiftly with confidence, I have to check, cross check and check again, as I said I take this seriously this must be correct the first time.     
The other day I was cced a mail conversation about MAC addresses. I did not look at it, but these mails just kept coming, I opened the fifth MAC address  mail, to my astonishment I realised I was responsible for handing out MAC addresses, not only within the company but to sub suppliers too.
In this last mail a purchaser begged for more MAC addresses, a supplier had just stopped production of a component the Tierp Factory was in short supply of. I take codes serious, but that’s nothing compared with production stop in a factory. I take great pride in helping the factories improving their processes by better IT systems, Reading about halted production really got me going, in no time minutes that is I produced the required MAC addresses, later it took almost half an hour for me to check I done it right.

Riccardo does not exists, but I get similar urgent requests almost daily.