We're trying to troubleshoot a problem with our custom constituent headers that seems to be related to the batch number. Can anyone shed any light as to how the batch number actually gets passed into the constituent header?
If it's a custom header in InfoMaker (and not a Flex Header), then what happens is the datawindow is passed a customer_no, which is then passed on to a stored procedure. Weird data things could be happening at either of those places, either inside the datawindow in InfoMaker, or inside the stored procedure.
What I find curious is that the default header is supposed to be backed by AP_DONOR_HEADER1, but if you look at that procedure (in 14.1.11, at least), it will always return NULL for batch_no. And yet the current batch no is displayed! So either that's not the procedure actually in use, or the batch_no is being populated on the infomaker or powerbuilder side of things.
Remember that the batch information is being taken from your current client session and user account, not from the customer, so you won't get anything back in Infomaker or SSMS.
Right, but the infomaker datawindow and SQL procedure are still supposedly run with the client app's session context, so even on the database you could do something like:
SELECT TOP 1 batch_no FROM dbo.T_BATCH WHERE status = 'O' AND owner = dbo.FS_USER() AND open_loc = dbo.FS_LOCATION();
Although I get your point and it probably explains why AP_DONOR_HEADER1 doesn't have this above code. It probably means that the client app maintains its current batch_no as part of some local state and injects that into the header datawindow upon display. I'm not sure if the default header is available to copy in infomaker, but it would probably be interesting to look at where the batch_no display comes from.