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

Print and retrun to the next parameter string

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

  • Print and retrun to the next parameter string

    Please see below for an xbasic code that I have designed to print my reports.

    I have check boxes that I use to select each account number that I call "depcomb". What I want to do is this, since I am printing in a duplex format I want each account that I checked to print and return to the previous state and then fetch the next checked "depcomb" and print, kind of a print and return.

    I want it this way because if I dont do like this, I will have to check the checkboxes one after and print after each checked box is finished printing. Time consuming indeed. Could someone please help me to automate this?

    ==============================================
    'Preview a report, label, letter, form or browse layout. You can specify which records to preview.

    filter = " (Depcomb = [varCMulti->prms.Parameter1] )"
    get_parameters_string = <<%string%
    Parameter1|Depcomb|Character|Check Box-List Box|000000|=table.external_record_content_get("lkupdpt","Depcomb","Depcomb",".t. .and. unique_key_value()")
    %string%
    ok_label = "&OK"
    cancel_label = "&Cancel"
    dialog_title = "Parameters"

    'Prompt for parameter values. Store results in a 'dot' variable called 'prms'
    dim prms as p
    prms = ui_get_parameters(dialog_title,get_parameters_string,ok_label,cancel_label)

    if prms.last_button_pressed = "OK" then
    'Replace parameters in the filter with actual values
    query.filter = replace_parameters(filter,local_variables())

    query.order = ""
    else
    end
    end if
    'Prompt user whether to print, or preview the layout. Set default to Print
    prompt_result = ui_get_print_or_preview("Print")
    If prompt_result = "Print" then

    :Report.Print("Report_portrait-monthy",query.filter,query.order)

    Else if prompt_result = "Preview" then
    :Report.Preview("Report_portrait-monthy",query.filter,query.order)
    End if


    ===========================================

    Thanks
    Last edited by kdankwah; 12-17-2007, 04:52 PM.

  • #2
    Re: Print and retrun to the next parameter string

    Your code seems to be that revealed by viewing the xbasic behind several action scripts.

    Is it your intention and belief that when the code gets to

    prms = ui_get_parameters(dialog_title,get_parameters_string,ok_label,cancel_label)
    if prms.last_button_pressed = "OK" then

    that the prms variable holds a list of Depcomb values representing records to be printed? If so, since ui_get_parameters() is an internal function whose workings are somewhat obscure, insert a line

    ui_msg_box("",""+prms)

    so we can see how to proceed. I assume you will see a comma separated list but am unsure. The code to "wrap around" the following print portion will depend on the structure of the prms variable.
    There can be only one.

    Comment


    • #3
      Re: Print and retrun to the next parameter string

      I am getting an "argument is incorrect data type" when I insert the line with the code you gave. Do you know of any other way I can do this? I can do with a prompt to insert the accout number (depcomb) and then print.

      Thanks

      Comment


      • #4
        Re: Print and retrun to the next parameter string

        The portion that does the printing is, of course

        Code:
        query.filter = replace_parameters(filter,local_variables())
        
        query.order = ""
        'Prompt user whether to print, or preview the layout. Set default to Print
        prompt_result = ui_get_print_or_preview("Print")
        If prompt_result = "Print" then
        
        :Report.Print("Report_portrait-monthy",query.filter,query.order)
        
        Else if prompt_result = "Preview" then 
        :Report.Preview("Report_portrait-monthy",query.filter,query.order)
        End if
        Suppose you had a comma separated list of depcomb values (character data type) in a character variable named dep_list.


        Code:
        rpt_count = w_count(dep_list,",") 'count the number of depcombs to print
        for i = 1 to rpt_count
        query.filter = "depcomb = "+quote(word(dep_list,i,","))
        query.order = ""
        'Prompt user whether to print, or preview the layout. Set default to Print
        prompt_result = ui_get_print_or_preview("Print")
        If prompt_result = "Print" then
        
        :Report.Print("Report_portrait-monthy",query.filter,query.order)
        
        Else if prompt_result = "Preview" then 
        :Report.Preview("Report_portrait-monthy",query.filter,query.order)
        End if
        next i
        should step through the list printing/previewing the report for each value.
        There can be only one.

        Comment


        • #5
          Re: Print and retrun to the next parameter string

          I have the dpt_list as a table does that make any difference? Its a character type field.

          Thanks

          Comment


          • #6
            Re: Print and retrun to the next parameter string

            table.external_record_content_get("lkupdpt","Depcomb","Depcomb",".t. .and. unique_key_value()")

            returns a crlf() delimited list of all depcomb values in the lkupdpt table

            Code:
            dep_list = table.external_record_content_get("lkupdpt","Depcomb","Depcomb",".t. .and. unique_key_value()")
            
            rpt_count = w_count(dep_list,crlf()) 'count the number of depcombs to print
            for i = 1 to rpt_count
            query.filter = "depcomb = "+quote(word(dep_list,i,crlf()))
            query.order = ""
            'Prompt user whether to print, or preview the layout. Set default to Print
            prompt_result = ui_get_print_or_preview("Print")
            If prompt_result = "Print" then
            
            :Report.Print("Report_portrait-monthy",query.filter,query.order)
            
            Else if prompt_result = "Preview" then 
            :Report.Preview("Report_portrait-monthy",query.filter,query.order)
            End if
            next i

            should step through all the records offering a chance to print/preview.
            There can be only one.

            Comment


            • #7
              Re: Print and retrun to the next parameter string

              Hey Stan,

              I cant thank you enough, but as it is now, the check box section is running and when I check the boxes it runs all the accounts that I have checked before it goes into the parameter loop and do the same printing looking at the lkupt table.

              How do I do away with the check boxes? I tried commenting that portion out but it gives me errors, other than that everything works as nice and dandy.



              Thanks once again.

              Comment


              • #8
                Re: Print and retrun to the next parameter string

                What does your code look like now and do I understand you want it to do what it does now but remove the checkboxes only?
                There can be only one.

                Comment


                • #9
                  Re: Print and retrun to the next parameter string

                  'Preview a report, label, letter, form or browse layout. You can specify which records to preview.

                  filter = " (Depcomb = [varCMulti->prms.Parameter1] )"
                  get_parameters_string = <<%string%
                  Parameter1|Depcomb|Character|Check Box-List Box|000000|=table.external_record_content_get("dpt_list","Depcomb","Depcomb",".t. .and. unique_key_value()")
                  %string%
                  ok_label = "&OK"
                  cancel_label = "&Cancel"
                  dialog_title = "Parameters"

                  'Prompt for parameter values. Store results in a 'dot' variable called 'prms'
                  dim prms as p
                  prms = ui_get_parameters(dialog_title,get_parameters_string,ok_label,cancel_label)

                  if prms.last_button_pressed = "OK" then
                  'Replace parameters in the filter with actual values
                  query.filter = replace_parameters(filter,local_variables())

                  query.order = ""
                  else
                  end
                  end if
                  'Prompt user whether to print, or preview the layout. Set default to Print
                  prompt_result = ui_get_print_or_preview("Print")
                  If prompt_result = "Print" then

                  :Report.Print("Report_portrait-monthy",query.filter,query.order)

                  Else if prompt_result = "Preview" then
                  :Report.Preview("Report_portrait-monthy",query.filter,query.order)
                  End if

                  dep_list = table.external_record_content_get("dpt_list","Depcomb","Depcomb",".t. .and. unique_key_value()")

                  rpt_count = w_count(dep_list,crlf()) 'count the number of depcombs to print
                  for i = 1 to rpt_count
                  query.filter = "depcomb = "+quote(word(dep_list,i,crlf()))
                  query.order = ""
                  'Prompt user whether to print, or preview the layout. Set default to Print
                  prompt_result = ui_get_print_or_preview("Print")
                  If prompt_result = "Print" then

                  :Report.Print("Report_portrait-monthy",query.filter,query.order)

                  Else if prompt_result = "Preview" then
                  :Report.Preview("Report_portrait-monthy",query.filter,query.order)
                  End if
                  next i

                  Comment


                  • #10
                    Re: Print and retrun to the next parameter string

                    If you want to print the report for each unique value in the depcomb field just use the part I suggested.

                    Code:
                    dep_list = table.external_record_content_get("dpt_list","Depcomb","Depcomb",".t. .and. unique_key_value()")
                    
                    rpt_count = w_count(dep_list,crlf()) 'count the number of depcombs to print
                    for i = 1 to rpt_count
                    query.filter = "depcomb = "+quote(word(dep_list,i,crlf()))
                    query.order = ""
                    'Prompt user whether to print, or preview the layout. Set default to Print
                    prompt_result = ui_get_print_or_preview("Print")
                    If prompt_result = "Print" then
                    
                    :Report.Print("Report_portrait-monthy",query.filter,query.order)
                    
                    Else if prompt_result = "Preview" then 
                    :Report.Preview("Report_portrait-monthy",query.filter,query.order)
                    End if
                    next i
                    To be safe you could create a new button and add an inline xbasic action script element and put just this code in it. Try the new button. If this does what you want then delete the old button.
                    There can be only one.

                    Comment


                    • #11
                      Re: Print and retrun to the next parameter string

                      Thanks a lot.

                      Comment


                      • #12
                        Re: Print and retrun to the next parameter string

                        It works. Now to all on the forum who will like to print duplex, this code will print duplex by looping into a parameter set by the user, it could either be an account number or anything :) and the user controls the printing.

                        Thanks

                        Comment

                        Working...
                        X