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

Convert Excel Spreadsheet to useable table

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

    Convert Excel Spreadsheet to useable table

    Hello! The following issue seems like it should have a simple solution, but I can't seem to figure it out, so help!! (I think the issue could even be solved in Excel, if I could figure it out. I tried using PivotTable to no avail).

    I have an excel spreadsheet of price levels and prices which I have imported (see attached sample excel file). I plan to use the resulting table to post prices to another table based on a "price_level" field (1 through X) and a "grade" field (AAAA through XXXX).

    The excel file has been given to me with the grades listed as headings (see example file) with the prices listed in columns.

    I need to convert the file (in excel or Alpha) so I have field names called price_level, grade, and price. (see example file) This will allow me to post the price to another table if I match the price_level and grade. In other words, I'm converting an array-like spreadsheet to a "flat" table.

    Please help me if you can.........the real spreadsheet is quite large so it would be a pain to do manually.

    Thanks! Michael

    #2
    Re: Convert Excel Spreadsheet to useable table

    Michael,

    Is this something that you would be doing on an ongoing basis or just once?

    My initial thought is to do this in Excel first and then do a simple import to Alpha. If it is just once that you need, the coding is easier. Otherwise, more questions will need to be asked in order to program around file differences.

    Comment


      #3
      Re: Convert Excel Spreadsheet to useable table

      Doug,

      This is probably a once-a-year update. It does not need to be an ongoing function accessed by the users. It can be doen "manually" once a year.

      Thanks,

      Michael

      Comment


        #4
        Re: Convert Excel Spreadsheet to useable table

        Do you also require the Price Key column you show in your sample? That was not mentioned above.

        Also, how many rows by how many columns?
        Last edited by Doug Page; 05-02-2007, 02:04 PM.

        Comment


          #5
          Re: Convert Excel Spreadsheet to useable table

          Doug,

          No, I don't require the Price_key column, I'm just showing that in the example as a unique identifier for each record. The spreadsheet is 45 columns by 19 rows.

          Thanks....Michael

          Comment


            #6
            Re: Convert Excel Spreadsheet to useable table

            michael,
            45 columns by 19 rows. This is the incoming (top table in your example)? If it starts with AAAA then BBBB... etc.. what happens to the sequence for columns 27-45? You originally said (AAAA through XXXX). How does that equate to either 19 or 45?
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Convert Excel Spreadsheet to useable table

              Mike,

              Sorry for the confusion!

              The example of AAAA to XXXX is only used to simply describe a list of "Grades", to avoid publishing our entire price levels for the public to see. An individual grade might be "AWP5" or "BBR6" which denotes a certain grade of tree in the nursery business. These "Grade" values are shown as column headings in the original Excel file and are capable of any 4-character combination.

              Right now there are 45 different "Grades" and 19 different price levels. In the final spreadsheet, I want to post the correct "Price", by simply matching a single "Grade" and "Price_level".

              Please let me know if this clears up your question, or if I've muddled the waters even more!

              Thanks.....Michael

              Comment


                #8
                Re: Convert Excel Spreadsheet to useable table

                Michael
                Try this.

                Take the excel spread sheet that you are starting with and save it into the folder with your A5 database as a dBase IV file named Pivot_out. Add the Pivot_out table to the database (Control panel '+' icon)

                Create a new table named Pivot_in with the three fields (field names and type must be exact):
                Price_level - character - 4
                Grade - character - 4
                Price - numeric - 8 - 2 decimals

                Copy and paste the following code into a new User Defined Function (UDF) named Pivot_table, or alternatively make it a script.

                Run it. It will take the table with the original data (Pivot_out) and convert it to the new table that you want (Pivot_in). Note the first steps of the script empties the recieving table, which has to have exclusive rights (no one else is in the table) to operate.

                Good luck and don't hesitate to ask questions if needed. By the way... any hops on that spreadsheet?

                Code:
                '=======  this code takes the data from the table Pivot_out and reshuffles it to the table Pivot_in
                
                'start message
                		ui_modeless_dlg_box("Message",<<%dlg%
                		{position=3,3}
                		{region}
                		{endregion};
                		{region}
                	The pivot process has started...    ;
                		{endregion};
                		%dlg%)
                		sleep(1)
                		ui_modeless_dlg_close("Message")
                
                ' delete all records in the receiving table
                	dim tblA as P
                	tblA = table.open("pivot_in")
                	tblA.zap(.t.)
                	tblA.close()
                
                ' collect the field names (AAA, BBB) into an crlf() list
                	DIM SHARED vLgrade as C
                	vLgrade= table.external_field_name_get("pivot_out","N")
                	vLgrade = *word_remove(vLgrade,1,crlf())
                	'msgbox("report",vLgrade)
                
                ' cycle through the list and add the values to the emptied table
                	dim vLGNow as C
                	for each vLGNow in vLgrade
                	
                		DIM SHARED vLGprices as C
                		DIM SHARED varC_result as C
                		vLGprices = table.external_record_content_get("pivot_out",vLGNow,"","")
                		'msgbox(vLGNow,vLGprices)
                		DIM vGradeNow as C
                		vGradeNow = alltrim(vLGNow)
                				dim vcycle as N=0
                				dim tbl as P
                				dim vlevel as C
                	
                			for each vLGPitem in vLGprices
                				vcycle = vcycle +1
                				vLevel = alltrim(str(vcycle))
                				tbl = table.open("pivot_in")
                				query.filter = ""
                				query.order=""
                				query.options=""
                				xi = tbl.query_create()
                	
                				tbl.enter_begin()
                					tbl.Price_level = vLevel
                					tbl.Grade = vGradeNow
                					tbl.Price = val(vLGPitem.value)
                				tbl.enter_end(.t.)
                				xi.drop()
                				tbl.close()
                			next
                	next
                ui_msg_box("Pivot Report", "Pivot Complete")
                Last edited by Mike Wilson; 05-02-2007, 05:45 PM.
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: Convert Excel Spreadsheet to useable table

                  Mike,

                  Wow! Thanks, I'll give it a try!

                  Sorry, we have a huge variety of trees, but no hops!

                  Thanks again for your time and great help!

                  Michael

                  Comment

                  Working...
                  X