Hi,
Has anyone ever tried to assign a number from a number series to a field on the request form of a report? I'm doing an Excel import via a ProcOnly report that imports lines into a temporary "staging" table that ultimately gets imported into a Purchase Order document. I want to insert an assigned document number into the staging table record, but show that number to the user prior to them running the process.
When I call NoSeriesMgt.InitSeries from the requet form, I receive the error:
"You cannot make any changes in the database until a transaction has been started."
The error message totally makes sense to me, but I'm wondering if anyone has figured out a workaround.
Thanks
Ron
0
Comments
Vijay Gupta
Couldn't you do this OnPreReport, or even OnPreDataItem of the first data item, and then tell the user what the document number is as follows:
IF NOT CONFIRM(DocumentNumber) THEN
ERROR('');
(CurrReport.QUIT doesn't always seem to work.)
I've always assumed this is because of table locking. Think of it this way: If you called a lock table on the number series in the OnInit trigger of a report, and that user walked away without closing the report or running it, your system is basically down.
My Blog - nav.education
Yeah, I get it. But this is a little bit unusual scenario - I just want to get the next incremental document number - but it's not a "controlled" document number, i.e. I don't really care if they grab a doc number then close the report - an unused document number really doesn't matter in this case. So on the request form, I want to get a table value, increment it and save. But I'm inferring from my observation and everyone's comments that you can't do this.
I'll do the next best thing as one of you suggested - assign the doc number after they click "OK" to start running the report.
Thanks for everyone's comments.
Ont the request form, I have a text box with a SourceExpr = DocNo
I put the following code in the "OnActivate" trigger for this control:
IF DocNo = '' THEN
IF CONFIRM('Do you wish a document number for this spreadsheet to be automatically assigned?', FALSE)
THEN
IF DocNo = '' THEN BEGIN
NoSeriesMgt.InitSeries(SSNoSeries,SSNoSeries,TODAY,DocNo,SSNoSeries);
END;