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

external_record_content_get Function

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

    external_record_content_get Function

    Hi!

    I'm working on a database that imports it's records from different files. What I'm trying to achieve is to do the following code:

    There is a table (podsaltemp) with a field (Man) that repeats its value about 20 times. It's a character field with the following structure as an example �000012�. I want to add all this characters to an array.

    Dim tbl as P
    Dim ManTemp as C
    Dim Shared ManArr as C

    tbl = table.open("podsaltemp")
    ManTemp = tbl.record_content_get("Man")

    Then I found this method to remove the duplicates.

    ManTemp = sortsubstr(ManTemp, crlf() )
    ManArr = *remove_duplicates(ManTemp)


    After having this list, I would like to use each value (in order) to add another field (Fob with a structure of 000.00 as Number), with which I found this function useful,

    Dim TotalMan as N

    TotalMan = TABLESUM("podsaltemp.dbf", "Man = '� + ManArr +�' ", "Fob")

    Now what I'm missing (if the code is right, because I have no way to check if it's working the way I'm expecting because of the missing code fragments) is to add only the FOB of the records that apply according to the following �code�:

    Two fields must be checked, Man and Pro

    If Man = ManArr and Pro = .first(P) (I assume this is the way to check that the first letter of the Pro field is a P) Then
    Add the FOB to TotalManP
    Else, If Man = ManArr and Pro = .first(T) Then (trying to nest the flow control)
    Add the FOB to TotalManT
    Else, If Man = ManArr and Pro = .first(B) Then
    Add the FOB to TotalManB
    End If

    At the end, I hope to have 3 total values.

    This must be done for all the numbers stored in the array at the beginning, so I suppose there must be a For flow control.

    So if I have lets say, 30 different numbers in the Man field, and 3 possible totals from each, I would need a place to store this in a order way (may be an array, or a table) to then take them and post them in a report.

    It's pretty complex... but if you happen to know just a tiny part of the solution for the whole problem, that would be great.

    Thank you in advance, I had been breaking my head with this problem for many hours.

    Enrique.
    Last edited by elopez; January 30, 2012, 10:05 PM.

    #2
    Re: external_record_content_get Function

    Can anybody help me display what this function is storing in the variable?
    Use the exact same code in the interactive window, using the return key at the end of each line.

    Then use

    ? list

    to see what the list variable holds.
    There can be only one.

    Comment


      #3
      Re: external_record_content_get Function

      Enrique.
      Have you considered using the Join Operation using an Expression?
      See our Hybrid Option here;
      https://hybridapps.example-software.com/


      Giving advice is dangerous.
      Giving "Good Advice" can be fatal.

      Comment


        #4
        Re: external_record_content_get Function

        Stan,

        Thank you for the advise, it's the first time I use the interactive window, because I didn't understood it.

        Ted,

        I just began learning A5, I'm still exploring options so I'm applying what I would do in other programming languages. I'll try that method, but because the number that links both tables (from MAN field) changes every time, so it would need somehow a counter or something similar. That's the reason why I want to first read that field from the file, store it in a list, remove it's duplicates and then follow that list to be sure all the MAN values are processed.

        Comment


          #5
          Re: external_record_content_get Function

          Then perhaps I could point you at the Deduplication Operation?
          Learning Alpha takes a bit of time, as you probably know by now, and developers coming from other languages have a hard time getting to grips with the built in facilities. Access users seem to have a lot of trouble initially.
          Please let us know how you achieve what you are after, as we are all learning - all the time!
          See our Hybrid Option here;
          https://hybridapps.example-software.com/


          Giving advice is dangerous.
          Giving "Good Advice" can be fatal.

          Comment


            #6
            Re: Code problem with Record manipulation

            Ted

            You are referring to the DeDupe Utility - Delete Duplicate Records?

            dedupeutility.PNG
            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


              #7
              Re: external_record_content_get Function

              No Al, I was in the Operations Tab.
              See our Hybrid Option here;
              https://hybridapps.example-software.com/


              Giving advice is dangerous.
              Giving "Good Advice" can be fatal.

              Comment


                #8
                Re: external_record_content_get Function

                Enrique,
                I'll try and help for the parts I can follow. Notes are in the code.
                Code:
                ' collect the variables for table name, and field names
                ' >>>> I did this so I could use a table of mine for testing
                	dim tablename as C="podsaltemp"    
                	dim field1 as C="MAN"
                	dim field2 as C="FOB"
                
                'Open the table and obtain a list of the unique values in the MAN field
                ' >>>>>  You don't have to remove duplicates if you only obtain unique values
                	Dim tbl as P
                	Dim ManArr as C
                	tbl = table.open(tablename) 
                	ManArr = tbl.record_content_get(field1,field1,"unique_key_value()")
                		'msgbox(manarr)
                        tbl.close()
                	
                '>>>>>  At this point you have a list of values, delineated by crlf() in the variable ManArr
                
                ' "I would like to use each value (in order) to add another field (Fob with a structure of 000.00 as Number), 
                '   with which I found this function useful, 
                
                	'Dim TotalMan as N
                	'TotalMan = TABLESUM("podsaltemp.dbf", "Man = '” + ManArr +”' ", "Fob")
                
                '>>>>   this wont work because the variable ManArr is a list of values not an individual value.
                '  Your filter expression in the Tablesum function won't work.
                '  You will need to loop through the ManArr list and get the sum of all the FOB for each MAN
                '  convert number to character, then concatenate them into a string with a delineator 
                '  (...) to show them.
                
                	dim foo as C
                	dim vfilter as C
                		
                	dim vc_Man_FOB_list as C=""
                	for each foo in ManArr
                		vfilter=field1+"="+chr(34)+foo+chr(34)
                		vc_Man_fob_list=vc_Man_FOB_list+alltrim(foo)+"..."+ltrim(str(TABLESUM(tablename,vfilter,field2),10,2))+crlf()
                	next
                
                ' Show the contents of the output variable
                	msgbox(vc_Man_FOB_list)
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: external_record_content_get Function

                  Mike, I want to thank you for the code you just posted. It has shown me how to manage the variables within the functions. Also, you have solved a great part of my issue.

                  Right now I'm working on adapting the code to my data base. I'll post it when I get it right so you can look at the final result.

                  Again, I thank you a lot for your help. It has been a huge advantage.

                  Enrique.

                  Comment

                  Working...
                  X