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

Concatenated String On A Report

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

    Concatenated String On A Report

    I Have This Script Below That Works Great On A Button Of The Input Form. I Am Having Problems Setting Up A Function With This Script To Do The Same On A Report.

    Can Someone Help!!!!

    SCRIPT:

    tbl = table.current()
    count =0
    lineitems = ""
    ct = table.get("flrpln")
    ct.fetch_first()
    while .not. ct.fetch_eof()
    count = count + 1
    if trim(ct.operid) "" "DESC" then
    lineitem = lineitem + trim(ct.operid) + space(3)
    end if
    end while
    tbl.lineitems = lineitem



    All This Script Does Is Concatenate One Field In A Table Of A (1-Many) Child Table And Stores It To A Field In The Header Table. All I Wish To Do In The Report Is List One Character String With All Of That Invoice Child Items; (Invoice Item Len is 6-char.)

    Thanks Kerry

    #2
    RE: Concatenated String On A Report

    I don't understand all of your post but....

    why do you want to create a function to hold this script, why not place the script in the report's onprintinit event? or have this script precede a script to print the report, both on the same button?

    Your script seems to be missing a

    ct.fetch_next() after the "end if"

    You create and increment, at least once whether or not any matching records are found, a variable "count", but you don't seem to use this variable. The increment count = count +1 would make more sense inside the if...end if loop.
    There can be only one.

    Comment


      #3
      RE: Concatenated String On A Report

      Also


      lineitem = lineitem + trim(ct.operid) + space(3)

      should generate an error. Since you start with

      lineitems = "", I believe this should be

      lineitems = lineitems + trim(ct.operid) + space(3)

      then

      tbl.lineitems = lineitems
      There can be only one.

      Comment


        #4
        RE: Concatenated String On A Report

        Stan Using The Onprintinit Event As I Understand Will Only Fire When The Report Begins To Print.

        I Have A Parent Table And A Child Table Of Many Records Connected To One Parent Table.

        I Am Trying To Print A Report Of All Parent Records With One Character String Made Up Of One Field From All The Child Records That Match The Parent Record Key.

        Example: Child Records --- 'A101 A102 A103 A104 A105' All In One String On The Report Of The Parent Report. I Am Only Wanting To Show Invoice Product Item In A Character String On The Report Along With Other Parent Info.

        As For My Script You Are Correct That I Made Some Type-O Errors When Typing It Late Last Night.

        Thanks Kerry

        Comment


          #5
          RE: Concatenated String On A Report

          Kerry,

          I'd approach this differently.

          The OnPrintInit script fires once, before the report layout is initialized. It does not fire each time a new parent table record is fetched.

          I'd create an intermediate table and base the report on it instead of your current set. This table would have a single character type field to hold the concatenated string for each parent table record.

          Then, I'd arrange my script to:

          1) zap the intermediate table
          2) populate it again using your original script to build the concatenated string
          3) run the report against the new table.

          -- tom

          Comment


            #6
            RE: Concatenated String On A Report

            Hi Tom,

            Nice To Hear From You.. Since The Conference.. Where Is V6?

            I Wish That Alpha Would Change/Make Improvements In The Report Writer Function Of V5/V6. You Should Be Able To Perform The Same Tasks In A Report As You Do In A Form On Any Object Of The Report, But You Can Not. It Seems That The Report Writer Does Not Have Enough Event Controls...

            My Main Problem Is That I Have A Child Table That Has About 7 Million Records And Growing. With Alpha It Is Becoming Very Dificult For My Programmers To Create Reports With Out Spending A Great Deal Of Time Watching Indexes. I Am Thanking About Using Crystal Reports Or Something Similar To Do My Reporting.

            I Have Developed A C++ Program Similar To The Program I Developed In Alpha In The Spirit Of Make My Programmers Happy. I Am Hoping That V6 Will Be A Better Product. Not Knocking V5, But Producing A Output(Report) Should Be Very User Freindly And Made Possible For The End User To Accomplish And Not My Programmers.

            I Have Set A Time Table For One Of My Programmers To Start Using V6 In September Of This Year Or As Soon After When It Is Released.

            Nice Talking To You ---

            P.S. I Was Hoping That I Did Not Have To Create Another Table To Print This Report.

            Comment


              #7
              RE: Concatenated String On A Report

              An alternative would be to change the structure of your existing parent table to include a new field to hold the concatenated string. This could be populated instead of using a different table. It could even be kept "current" as new child table records are entered. Lots of options for you.

              -- tom

              Comment


                #8
                RE: Concatenated String On A Report

                Kerry,

                Hope I am not out of line, but Crystal Reports is not more friendly than A5V5. There is more power to some things, but considering the cost???

                It will be an experience for you if you never used it before.

                I AM accomplished at CR and adequate at VB.

                Luck.
                Dave
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment


                  #9
                  RE: Concatenated String On A Report

                  That Option Was Explored, But Not Fesiable Because The Child Records Are Changed Too Often.

                  At The Time Of Table Creation We Did Not Understand The Limited Capacity Of The Report Module. If We Did We Would Have Structured Our Tables For Parent Level Reporting Only.
                  Now Any Time We Need A Report That Requires A Different Table We Must Add To Or Create A New Set First -- Why!

                  At The Time We Had About 4 Or 5 Million Records That Needed Importing Into Alpha And Those Records Did Not Have This Extra Field. It Took My Programmers About 2 Weeks To Import All This Data And Another Week To Design All The Input Screens. They Like Me Are Main Frame Programmers That Thank As I Do That Any Data In A Data File (Table) Should Be Reported At Will With Out Controls Or Limitations. Besides, The Only Important Factor Of Automation Is What You Can Produce In Real Time Reporting.

                  Most Of My Customers Design Airplanes And Airplane Parts Which Requires A Great Deal Of Reports/Reporting. Every Day New And Different Reports Must Be Designed With A Minutes Notice. With More Than 50 Different Tables(MAX) It Is Becoming A Full Time Job For One Of My Programmers.

                  Thanks Again, Kerry

                  Comment


                    #10
                    RE: Concatenated String On A Report

                    Make a user defined function out of your program - pass the parent id to the function and return the concatenated line item string.

                    Comment


                      #11
                      RE: Concatenated String On A Report

                      Kerry,

                      I worked for a Small company with a program written in VB that all reports were done in CR. I did most of those reports. We had 38 tables with hundreds of reports and more each week that kept me busy full time and more. We had 2 other people that were able to make some of the simpler reports. This program was/is sold nationally to do Auto/Boat/RV Dealerships.

                      The reports have to be perfect and to the penny because a lot of the reports were bank contracts and lease contracts.

                      There is no report that I ever wrote in Crystal Reports that I cannot duplicate in Alpha5V5.

                      Dave
                      Dave Mason
                      [email protected]
                      Skype is dave.mason46

                      Comment


                        #12
                        RE: Concatenated String On A Report

                        Maybe I'm being naive, but, instead of using a script, why not create a calculated field in the report which is a concatenation of all of the child invoice numbers, and then place this calc field into the Group header?

                        allinvoic allinvoic+trim(child-"invoice)+" "

                        The report should do a pre-calc and place the required information in the header, and then list all the detail in the format that you want.

                        Again, maybe I'm not seeing everything you want to do, but this should work.

                        Tom

                        Comment


                          #13
                          RE: Concatenated String On A Report

                          Kerry,

                          Even though I have no mainframe experience, when one arranges the data as you chose to do one must make two passes through the data to generate your report by hand, right? First pass would collect the field values needed to build the concatenated string for each parent table record. Second pass to print the report, line by line.

                          Generating a temporary table to hold the results of the 'first' pass through the data, and then basing the report on the temporary table is the Alpha Five equivalent.

                          -- tom

                          Comment


                            #14
                            RE: Concatenated String On A Report

                            Reading Other Messages; It Is Apparent That I Must Use A UDF in Order To Accomplish This Task, But I Can Not Find Any Documentation On How To Use UDF's In Reporting. Can Someone Explain By Example How To Use UDF In A Report. Perferably Alpha Or Someone That Does This All The Time.
                            I Would Like To Know How To Fetch Data From More Than 10 Tables And Create One String On A Report.

                            Comment


                              #15
                              RE: Concatenated String On A Report

                              There is no trick to using a UDF on a report.It's no different than using a UDF anywhere else.
                              Define a UDF, let's say, Lines_string() and put the code into the global function - then the function will be available to use anywhere on a form or report in a calculated field - just like Alpa's built in functions.

                              Comment

                              Working...
                              X