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

How to simply populate an array from a comma delimited text file for individual cell manipulation.

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

    #16
    Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

    Stan, you really are a star on this forum. Thank you for the full explanation of remove and for filter detail.

    Paul :)

    Comment


      #17
      Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

      OK - Could you help me resolve one more thing, please.

      I created the test data that I originally posted, not really appreciating that I should provide a typical set of numeric ratings data. Ie, normal rating data could have three decimal places, no decimal places, etc.
      In addition the number of leading digits could be anything up to 4.
      Using the example code you provided and what help I could glean from Alpha documentation, I have no problem sorting the array data on more than one column with the test data I originally provided.
      However, using real data the ratings show up in an unordered sequence within courseid.
      I am using:

      arr_ptr.sort("A","courseid + val(rating)")

      The courses are sorted OK but the ratings are semi-sorted.
      I am not sure what I can do to the numeric rating value to get the result I want. Maybe go back to a string representation with leading zeros and a truncated number of decimal places.
      Please can you tell me what function I should use to fix this.

      Thanks,

      Paul

      Comment


        #18
        Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

        Try

        Code:
        arr_ptr.sort("A","courseid + padl(alltrim(rating),10,\"0\")")
        Last edited by Al Buchholz; 10-04-2016, 06:42 PM. Reason: added code tag so backslashes will show.
        There can be only one.

        Comment


          #19
          Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

          Sorry Stan, I can't get it to work. I attach a stripped down file with just courseid and ratings. The ratings are more typical of the expected numeric values.
          Could you have a look please?

          Thanks,

          Paultestrating.txt

          Comment


            #20
            Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

            Code:
            arr_ptr.sort("A","courseid + padl(alltrim(str(val(rating),10,2)),10,\"0\")")
            Last edited by Al Buchholz; 10-04-2016, 06:41 PM. Reason: added code tag so backslashes will show.
            There can be only one.

            Comment


              #21
              Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

              Hi Stan,

              Won't work for me.

              Returns this output:

              ?file_txt
              = 127279538|6.2
              127279538|5.7
              127279538|6.4
              127279538|8.2
              127279538|6.4
              127279538|16
              127279538|14.5
              127279538|14.5
              127279538|14.5
              127279538|30
              127279538|16
              127279538|30
              127279538|14.5
              127279538|30
              127279538|16.5
              127279538|19.5
              127279538|18
              127279543|2.84
              127279543|4.7
              127279543|7.2
              127279543|8.2
              127279543|11
              127279543|14
              127279543|16
              127279543|19.5
              127279543|44
              127279543|95
              127279543|65
              127279543|95
              127279548|5.3
              127279548|16
              127279548|13.5
              127279548|9.4
              127279548|15
              127279548|18.5
              127279548|19
              127279548|46
              127279548|48
              127279548|2.42
              127279548|30
              127279548|25
              127279548|48
              127279548|6.6
              127279553|1.97
              127279553|11.5
              127279553|4.3
              127279553|14.5
              127279553|29
              127279553|24
              127279553|48
              127279553|10.5
              127279558|2.06
              127279558|12.5
              127279558|5.1
              127279558|10
              127279558|44
              127279558|48
              127279558|7.2
              127279558|21
              127279563|7.2
              127279563|8
              127279563|7.4
              127279563|10
              127279563|10
              127279563|13.5
              127279563|16
              127279563|14.5
              127279563|16.5
              127279563|11
              127279563|21
              127279563|14.5
              127279563|19
              127279563|19.5
              127279563|15.5
              127279563|10.5
              127279563|14.5
              127279568|9.8
              127279568|6.6
              127279568|7.2
              127279568|6.2
              127279568|7.6
              127279568|16.5
              127279568|16.5
              127279568|9.2
              127279568|12.5
              127279568|24
              127279568|14.5
              127279568|24
              127279568|11.5
              127279568|20
              127279568|24
              127279568|16.5
              127279568|19.5
              127279573|5.7
              127279573|5
              127279573|12
              127279573|10.5
              127279573|42
              127279573|24
              127279573|16
              127279573|30
              127279573|9.8
              127279573|11
              127279573|9
              127279573|26
              127279573|6.4
              127279573|11
              127279573|8.8
              127279573|18
              127279573|24

              etc.

              Comment


                #22
                Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

                This my interactive xbasic:

                ' Delete the array variable (should it exist)
                delete arr_ptr

                ' Populate search string file_txt with contents of your text file
                file_txt = get_from_file("C:\alphatest\testrating.txt")

                ' Replace every occurrence of Find_String in Search_String with a Replace_String
                ' file_txt is Search_String
                ' "," is Find_String
                ' "|" is Replace_String
                file_txt = strtran(file_txt,",","|")

                ' WORD(C character,N word_number[,C separator[,N num_words]])
                ' file_txt is c character to extract from
                ' 1 is word_number - An integer that specifies which start word to return from, counting left to right
                ' NOT sure how crlf() works here - ambiguous Alpha help - Stan can probably explain
                hdr = word(file_txt,1,crlf())

                ' Remove header line from text file starting at line 1 for just 1 line (default) because not specified
                file_txt = *line_remove(file_txt,1)

                ' Could not find any help on this function - Stan can probably explain
                ' I assume it removes any blank lines contained in the text file specified
                file_txt = remove_blank_lines(file_txt)

                ' Counts number of words in a character string - hdr delimited by "|"
                'dim_size = w_count(hdr,"|")
                dim_size = line_count(file_txt)

                ' dimensions the array by the dim_size variable above
                dim arr_ptr[dim_size] as P

                ' Populates the array with contents of text file using heading line field names in the variable hdr
                arr_ptr.initialize_properties(hdr,file_txt)
                arr_ptr.filter("val(rating) = 0",.t.) 'this removes zero value entries from the array pointer

                fnumb_rows = line_count(file_txt)

                arr_ptr.sort("A","courseid + padl(alltrim(str(val(rating),10,2)),10,"0")")
                'arr_ptr.sort("A","courseID" + "rating")
                arr_ptr.dump(file_txt)

                ? arr_ptr.dump_properties("rating")

                ? arr_ptr.dump_properties("courseid")

                ?file_txt

                Comment


                  #23
                  Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

                  Don't know if I copied and pasted wrong or the forum ate the backslashes around the zero.


                  arr_ptr.sort("A","courseid + padl(alltrim(str(val(rating),10,2)),10,\"0\")")
                  Note, forum doesn't like my backslashes. Replace the | in the above with backslashes.
                  There can be only one.

                  Comment


                    #24
                    Re: How to simply populate an array from a comma delimited text file for individual cell manipulation.

                    Originally posted by Stan Mathews View Post
                    Don't know if I copied and pasted wrong or the forum ate the backslashes around the zero.




                    Note, forum doesn't like my backslashes. Replace the | in the above with backslashes.
                    Genius :)

                    Thanks, Stan

                    Comment

                    Working...
                    X