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



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

Advice - Working with an array

  • Filter
  • Time
  • Show
Clear All
new posts

  • Advice - Working with an array

    I have a browse on a form that has 14 columns with color equations and almost all of them have conditional formating as well. The conditional formatting has 2 possibilities which are both loookupc() statements. This is alot of looking up although it is with an index. The record each row's 14 or so columns need to look is the same record but different fields. I was thinking, which is dangerous for me by the way, could I read an entire record (or the fields I need) into one calculated field one time (some kind of array or cr-lf delimeted item), that I could then somehow reference the appropriate field's data for my conditional formatting fields and it would not have to relookup the data 28 times.

    1. Would this be a better or faster way to do this?

    2. Is this even possible? (I have no idea how to do this)?

    3. Any Hints?

    Thanks in advance.

  • #2
    Re: Advice - Working with an array

    So, each "Cell" in this browse has a conditional formatting? Or just the columns?


    • #3
      Re: Advice - Working with an array

      It is for each column. Each record in the browse has another record in the table associated with it. I have to compare values against the two records. Various symbols and colors show up to indicate the comparisons. I tried in the set to attach the same table with filters but it is very unreliable. I thought if I could easily read in the entire record or the fields I need that match the same reservation number in this case. Then all of the color expressions and conditional formatting could refer some how to a calculated field instead of doing a bunch of lookups.


      • #4
        Re: Advice - Working with an array

        John, firstly you want to try
        dim r2v as P
        dim tbl as P
        tbl =
        tbl.record_to_vars(r2v)	'1.Copy record to var r2v
        Is this a case where your reservation periods are across the top and the items down the left?
        Then you will want individual cells formatted according to reservation status and linked to reservation record, no?


        • #5
          Re: Advice - Working with an array

          Ray, your idea looks like what I was thinking. Question, how do you refer to the fields contained in the variable? Also, how can I run this xbasic for a calculated field, would I make a function out of it and call it from a calc field?

          The table being displayed is a schedule with each record in a browse time in ascending order. Each column are the services for that airplane. There are 2 entries for each aircraft, an arrival and a departure. The services could have been done on either the arrival or departure or both. I have to compare each line item of the Day and it's companion. I also need to know the days between.

          What I have been doing is using the color background of the column to indicate the status of the item. If the item was done or worse not done, on the companion arrival departure, I have put in a symbol to indicate both of these possibilities. I have a lot of lookups going on and it's pretty slow. I am not sure which is the worse culprit the color equations or the lookups. I need the color because it is the heart of the system and there is no other program out there like it. I know I am a newbie sloppy coder and I want to know find more efficient ways of making it happen.


          • #6
            Re: Advice - Working with an array

            I can help work it out for you but need to know
            1. are field names in each row the same name as the fieldnames you are looking up?
            2. If each record in the browse (I presume that means row) is time then the planes (x2 Arr/Dep) acros the top.

            Instead of referring to a field from you refer to the pointer variable with the fieldname like r2v.fieldname
            But will need more as above OR a sample browse to prepare an example.


            • #7
              Re: Advice - Working with an array

              Ray,Thank you for looking at this.
              are field names in each row the same name as the fieldnames you are looking up?
              Yes they are the identical record. Each record has a reservation number and a Type, the Type will be an "A" for arrival and a "D" for departure. They are 2 records in the same table and obviously then have the exact same information.
              If each record in the browse (I presume that means row) is time then the planes (x2 Arr/Dep) acros the top.
              See the attached screen shot. The main screen is based on a date and shows each record in time order. The columns are information about that arrival/departure and all the services that have been requested or have been done. What was happening is services were being duplicated because frequently the arrival and departure do not occur on the same day and most of the services could be done at either time and is a preference of that crew. If a service has been done on the arrival a green checkbox is shown, worse if a service was requested but not not done I show a red exclamation point. All I do is lookup the previous status of the arrival record, but I do this for each service. If I can easily reference the associated record, it would be faster I assume



              • #8
                Re: Advice - Working with an array

                So if it is an arrival entry with that reservation numer you want to behind the scenes check the departure record?
                And vice versa. And compare the viewed line values against its opposite number.
                Lets say for simplicity, the fields are called TIME,STAGE, CLIENT , RCAR
                1. You open the underlying table (in xbasic). Can keep it open for the duration, for better speed. Using the sample code snippet, table name has been saved in a variable called mytbl
                2. run that code after locating the partner record. Declare the variables first. The field values are all saved to R2V pointer variables
                3. When you determine conditions for colors etc, compare TIME.value on the form against variable r2v.time, and STAGE.VALUE to r2v.stage, client.value to r2v.client etc
                Last edited by Ray in Capetown; 08-08-2013, 02:15 PM.


                • #9
                  Re: Advice - Working with an array

                  Yes exactly. I would compare one to the other and I would use that to populate the browse. I had no idea you could do this.


                  • #10
                    Re: Advice - Working with an array

                    How do I find and set the pointer to the record with the open table, I would have the reservation number and if it was a "D"eparture I would look for the "A"rrival, but I have not used xbasic to do this before. I assume I can use table get since it is open already. Do I have to close the table then? But, since I have to do this for each line item in the browse. Should this be a formula that is then called by a calculated field?

                    I am trying to use the tbl.fetch.find here, i'll post back...

                    So what I tried was first creating a function:

                    FUNCTION getarrdep AS A (vresnum AS N, vtype AS C )
                    dim global r2v as P
                    dim tbl as P
                    dim indx_1 as P
                    tbl = table.get("res_detail")
                    if vtype ="D"
                    indx_1 = tbl.index_primary_put("dupentrya")     'this sets the index on a filtered index which  is made out of the resnum + "A"
                    rec = tbl.fetch_find(alltrim(str(vresnum)+"A")) 'I am trying to find the resnum + "A" for arrival using the variable passed to the function
                    end if
                    if vtype ="A"
                    indx_1 = tbl.index_primary_put("dupentryd")
                    rec = tbl.fetch_find(alltrim(str(vresnum)+"d"))
                    end if
                    END FUNCTION
                    Then I put a calculated field on the form:
                    test = getarrdep(RES_DETAIL->Resnum,Type) ' I thought this would force the function to run and pass the two variables which make up the reservation number and Type (Arrival or Departure)
                    I then put a calculated field on the form and displayed it in the browse:
                    datenextlast = r2v.rdate
                    This should display the date of the other event just as a test. The only date that came up was the first record in the table for every row. This has pushed my knowelege to way past comfortable. What do you think?
                    Last edited by johngtatp; 08-08-2013, 06:09 PM.


                    • #11
                      Re: Advice - Working with an array

                      Great so far John, you grasp the principle of reading all fields in answer to the thread topic .
                      What you seem to have now is a problem locating the correct record. Try work it out in the Interactive Window first.
                      Else Post a question on another topic if you want to help on that.
                      Also open another instance of the reservations table than the one the browse has open - ie not with table.get("res_detail") but as in the code segment,


                      • #12
                        Re: Advice - Working with an array


                        Thanks, I think I have the basics working and I have to tweak it a bit. Thanks for your help, never would of thought of such a thing. The question is if this will help my speed, that I will see. Thanks again!