Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

OnPrintExit Event ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: OnPrintExit Event ?

    do a test
    make a global variable
    at the end of the run, in interactive, check the value

    also, if you get the variable populated, I would update the clients in a different way - like this, but not until AFTER the report had closed
    Code:
    t=table.open("clients")
    t.index_primary_put("clientid")
    dim global clid as c (the variable used for storing)
    dim tempn as n
    n=w_count(clid,crlf())
    for i=1 to n
         tempn=val(word(clid,i,crlf()))
         rec=t.fetch_find(temp)
         if rec > 0
              t.change_begin()
                 '......
              t.change_end()
         end if 
    next
    t.close()
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    Comment


      #17
      Re: OnPrintExit Event ?

      Further Information.

      The reason that this all started was because my customer complained that the printer stopped half way through a print run. This happened after I had put in some code to update the records at print time. The thought was my code had upset the print routine.

      Yes, we are coming to it, the customer had installed an extension USB cable and plugged it into a different port on the computer.

      Having put the cable back to the original port, the print run works as designed.

      Moral of the story, add this to your list of questions as to why the printer has suddenly started to play up.

      So a big thank you to all contributors to this thread.

      I will be changing the code as the buttons change to red for all records as the batch is dumped to the print spooler.
      Regards
      Keith Hubert
      Alpha Guild Member
      London.
      KHDB Management Systems
      Skype = keith.hubert


      For your day-to-day Needs, you Need an Alpha Database!

      Comment


        #18
        Re: OnPrintExit Event ?

        The variable probably has to be global, though I wrote the code off the cuff without any testing and don't know for a fact if in the environment of a letter or a report a shared variable will work or not. Theoretically speaking, it should, but probably won't.

        As to fetch_find(), though logical but assuming the index used in the code is the same index used to filter for the report then fetch_next() will do just fine as you would expect the same records with the same order in both.

        Comment


          #19
          Re: OnPrintExit Event ?

          Hi,

          When I have the report, base on Child to parent(One to One) set, I set up as indicated in the "A5 Help" which is works fine but I have the problem with this report because repeating the values.
          So I changed the set as Parent to Child (One to one) and created the Report. In this report, I used this scripts at Section Events->Detail->OnRecord as
          Code:
          dim Global vLists as c
          	vLists = vLists+Insurance->project_id+crlf()
          	'vLists = alltrim(vlists)
          	vLists =*remove_duplicates(vLists)
          	
          Dim shared vPrintState as c  "It came from OnPrintExit events
          dim shared vResult as c
          dim tbl as p
          
          if vPrintState ="Yes" then
          	dim vTmp as n
          	dim vJobId as c
          	tbl = table.get("insur_logs")
          	'tbl.index_primary_put("Project_id")
          	vTmp = w_count(vLists,crlf())
          	for i = 1 to vTmp
          		vJobId = val(word(vLists,i,crlf()))
          		'rcd = tbl.fetch_find(vJobId) 'Maybe this <tbl>.fetch did not work
          		query.order="project_id"
          		query.filter="Project_id="+quote(vJobId)
          		qry = tbl.query_create()
          		rcd = qry.records_get()
          		if rcd>0 then
          			tbl.fetch_last()
          			'Get the list and find from this table
          		    tbl.change_begin()
          				tbl.isprinted ="Yes"
          			    tbl.printed_date = date()
          			tbl.change_end(.t.)
          		end if
          	next			
          		
          else
          	cancel()
          	end 
          end if
          I can get the vLists value after Exit Print, but I think, Script did not find the records by "vJobId". I need the help on why this filter not able to find the records

          Comment


            #20
            Re: OnPrintExit Event ?

            Good morning,

            I found the solution on my problem. I added the
            Code:
            dim shared vLists as c
            	vLists = vLists+Insurance->project_id+crlf()
            at Section Events-> Detail -> OnRecord and the previous scripts on the Report Events -> OnPrintExit.

            I think that A5 will get the lists to print from "OnRecord" event, not the "OnPrintExit".

            This scripts runs well However, I still have the problem which I cannot locate the last record of Child table after found the many child records.

            Can you address me how to get the last child table record after <tbl>.fetch_find()?

            Comment


              #21
              Re: OnPrintExit Event ?

              morning in the same topics ...

              how do we apply session variable to report ?
              i am referring to report with data source from sql 100%

              i would like to use the onprintinit event to query something from sql
              and place it to a variable , then use printhtml() etc to have it on the footer of my report


              it is all about subreport in sql...
              i know how to decorate the html data...

              i just don't know how to use session variable inside the onprintinit event
              may be hit is not possible ? i place session protected ulink as a test
              it is not picking it up for sure

              Comment


                #22
                Re: OnPrintExit Event ?

                i would like to use the onprintinit event to query something from sql
                Why not pass the "something from sql" to the report as an argument?

                Output_Filename as C = :Object_Type.PRINT( Layout_Name as C [, Filter as C [, Order as C [, Argument as SQL::Arguments ]]] )
                There can be only one.

                Comment


                  #23
                  Re: OnPrintExit Event ?

                  hi Stan,
                  that is encouraging, however i need to see more sample..
                  working on it now,,
                  thanks
                  kt

                  Comment


                    #24
                    Re: OnPrintExit Event ?

                    Ken,

                    I know nothing more about how to use the arguments parameter than what is in the documentation.
                    There can be only one.

                    Comment


                      #25
                      Re: OnPrintExit Event ?

                      Just to let everyone know,

                      ordinary WAS session variables working well inside the Onprintinit event
                      i have successfully query anything i want in or outside the related report

                      and use a simple calculate field to place my result anywhere on my report
                      without having to worry about duplicate records problem in sql sub report


                      ken tjia

                      Comment


                        #26
                        Re: OnPrintExit Event ?

                        Ken,

                        Can you show me how to
                        i have successfully query anything i want in or outside the related report

                        Comment


                          #27
                          Re: OnPrintExit Event ?

                          Hi,

                          I solved my this problem by,

                          (1) I have a Child - parent (many to one) set and created a report base on this set. The Child table has the Primary key
                          (2) Created the FINDER form same as Alphasport InvoiceReportMenu.

                          (3) On my Report
                          Code:
                           [COLOR=#b22222]OnPrintInit even ===>[/COLOR]
                          Dim Global Vlists as c
                          vLists =" "  'Clean 
                          
                          [COLOR=#b22222]Detail->OnPrint event ===>[/COLOR]
                          dim global vLists as c
                                  vLists = vLists+Insur_log->Id(PK)+crlf() 'get list
                                  'Tried for Parent Key value here, but not able to get the list nor not sure what to do???
                                  'So I made the Child Primary Key field and use it here.
                          
                          [COLOR=#b22222]OnPrintExit event ===>[/COLOR]
                           dim global vLists as c
                              ui_msg_box("test 1", "show me the current Lists "+vLists) 'Test, Just want to see what is going on from OnPrint event
                              
                          Dim shared vPrintState as c ="Yes"
                          dim Shared vResult as c
                          vResult = ui_dlg_box("Result",<<%dlg%
                          {lf};
                          {font=Courier new,10}
                          {wrap=60}
                          {region}
                          Did it print OK?
                          {lf};
                          Yes - Save the record.
                           No - Will not save the records.
                          {lf};
                          {endregion};
                          {region}
                          Printed and Save Record: [.10vPrintState^={Yes,No}];
                          {endregion};{lf};
                          {justify=center}
                          <.25&OK!ok>
                          %dlg%) 
                          
                          if vPrintState ="yes" then
                              dim tbl as p
                              dim vCount as n
                              dim vLogId as c
                              'Get the list and find from this table
                              vLists =*remove_duplicates(alltrim(vLists))
                              vCount = w_count(vLists,crlf())
                              
                              for i = 1 to vCount
                                  vLogId = word(vlists,i,crlf())
                                  ui_msg_box("test 2","show me  "+vLogId) '' Test Purpose only
                                  
                                  tbl = table.get("insur_logs")
                                  query.order=""
                                  query.filter="Inslog_id="+quote(vLogId)
                                  qry = tbl.query_create()
                                  rcd = qry.records_get()
                                  if rcd>0 then
                                      'tbl.fetch_last()  'If child table has more than one records by Parent Key value, want to save on last record but not work
                                      tbl.change_begin()
                                          tbl.isprinted ="Yes"
                                          tbl.printed_date = date()
                                      tbl.change_end(.t.)
                                  end if
                              next i
                          else
                              cancel()    
                          end if
                          I hope this may help someone.

                          Comment

                          Working...
                          X