Number Series assignment on the request form of a report

rsaritzkyrsaritzky Member Posts: 469
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

Comments

  • vijay_gvijay_g Member Posts: 884
    this type error comes when we have modify a record more than one time in a single process so check it.

    Vijay Gupta
  • afarrafarr Member Posts: 287
    Do you have to do this on the Request Form?

    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.)
    Alastair Farrugia
  • matttraxmatttrax Member Posts: 2,309
    You'll want to use your code later on in the report.

    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.
  • rsaritzkyrsaritzky Member Posts: 469
    matttrax wrote:
    You'll want to use your code later on in the report.

    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.

    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.
    Ron
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Which trigger are you calling this from?
    David Singleton
  • rsaritzkyrsaritzky Member Posts: 469
    Which trigger are you calling this from?

    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;
    Ron
Sign In or Register to comment.