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

Report on Crosstab Table

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

    Report on Crosstab Table

    I have created a crosstab operation that creates a new table that summarizes employee hours worked. I have attached an example PDF file for reference. The crosstab works as expected and you can see from the attached file that the output table has field names that are the dates for the work week. My question is this: How do I create a report for this table that will work everytime (every week) that I need to print it when each week the field names will change? In other words, I can create a report on the table in its current state, but the next time the crosstab is run for the next week, that field names will change to the new dates, and they in turn are no longer bound to the report since the fields have changed name (date).

    Thanks,
    Don
    Attached Files

    #2
    Re: Report on Crosstab Table

    The easiest thing to do is to use xbasic to rename the fields after the crosstab (Mon-Sun) and build the report after the fields are renamed. The report will then be consistent with the field names each time.
    There can be only one.

    Comment


      #3
      Re: Report on Crosstab Table

      Thanks for the reply Stan. I have not been able to find a Function or Method that allows me to change the field name in the table structure. I see where I can create or delete fields in the table, but not to rename it. Can you point me in the correct direction?

      Comment


        #4
        Re: Report on Crosstab Table

        You can get the current field names with (given a table pointer)

        old list = tbl.Field_Info_Dump("n,t,w,d")

        You know what the new names you want are so you build that list with

        new_list = "Employee,c,12,0"+crlf()+"Mon,n,7,0"+crlf()+"Tue,n,7,0"..............

        Then use table.fieldname_change("drive_path_tablename.dbf",old_list,new_list)

        Corrected the new_list expression to add field type, width, and decimals.
        Last edited by Stan Mathews; 04-14-2014, 02:23 PM. Reason: correction
        There can be only one.

        Comment


          #5
          Re: Report on Crosstab Table

          Stan -I will give that a try.

          Also, from reading the message board, I have also found a reference to a "mapped" table being used for formatting after a crosstab, but I do not see how that would help. Do you think that might also be a possible solution?

          Comment


            #6
            Re: Report on Crosstab Table

            Donald,

            Note my correction to my earlier suggestion. I had left off the type, width, and decimals sample values in the new_list expression.

            I don't have any experience with mapped tables but it seems the same issue would apply. You have to know the field names to map to something and the field names change each time the crosstab is run.

            old list = tbl.Field_Info_Dump("n,t,w,d") gets whatever the names are and they are replaced with new_list.
            There can be only one.

            Comment


              #7
              Re: Report on Crosstab Table

              I have been able to more simply change the field names right in the crosstab operation definition. I substituted "cdow(Workdate)" for the field/expression and that renamed the fields to Monday, Tuesday, etc. and also ensures that the correct day is assigne
              Attached Files

              Comment


                #8
                Re: Report on Crosstab Table

                This works but does generate another problem. If the crosstab table underlying the report does not have hours for say Sunday, then an error is generated on the report because the field is not found. I guess I would have to make all the fields and field titles conditional so they only show when needed and would have to initially build the report on a table with all fields available.

                Comment


                  #9
                  Re: Report on Crosstab Table

                  Well I am pretty much back to where I started with my problem. If the crosstab table generates data for 7 days worked (Mon thru Sun), and the report is set up for the same, all is well. But, if the crosstab only generates 5 days of hours (Mon -Fri), then the report generates errors because the fields for Saturday and Sunday are not in the crosstab table. To have this reliably work, the crosstab table would have to be scanned for missing days and empty fields would have to be added for the report not to bomb. Or conversely, the report would have to be automatically altered to match the available fields (which is even worse).

                  How then is a crosstab table reported on if you cannot guarantee what, or how many, fields the data may generate?

                  Comment


                    #10
                    Re: Report on Crosstab Table

                    Add zero valued records for each day prior to running the cross tab operation.
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: Report on Crosstab Table

                      Thanks Al - that does get me closer, but for that scheme to work automatically I would have to:
                      1) Determine for any given pay week what dates are missing and add however many records are required with the exact dates (days) that are missing and;
                      2) I would have to suppress the extra, added "dummy" records from showing up in the report.

                      I sure I can handle #2, but #1 sounds difficult for my skill level.

                      Comment


                        #12
                        Re: Report on Crosstab Table

                        Actually, maybe I can append records that represent seven valid days from ANY week (out of a table set up with just those records), just so the fields are there, and then suppress the extra records.

                        Comment


                          #13
                          Re: Report on Crosstab Table

                          Originally posted by DORaymond View Post
                          Actually, maybe I can append records that represent seven valid days from ANY week (out of a table set up with just those records), just so the fields are there, and then suppress the extra records.
                          Good thinking. You're getting there..
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #14
                            Re: Report on Crosstab Table

                            Adding the "dummy" records works perfect. Thanks for everyone's help.

                            Comment

                            Working...
                            X