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

query table by an array

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

    query table by an array

    Here is the logic of a process i am trying to write some xBasic for. I need help with steps 3 & 4. I can do them I think there is an easier way and I need some expert advice"

    1.) open work order table
    a.) find all work orders that match "est_state_date <= '"+vDate+"' >= critical_date" .and. "ongoing = .t."
    b.) create query with filter above.
    c.) put WO_ID field from query results into an array(aWO[60,1])

    2.) open lineup table
    a.) find all WO's for (("ongoing = .t.") .and. ("Lineupnum = '"+vDate+"')
    b.) create query with filter above
    c.) put WO_ID field from lineup table query into an array(aLU[60,1])

    3.) take any WO_ID in array "aLU" out of array "aWO"- Is there a function to do this or do I need to create my own


    4.) query workorder table by the array "aWO" - again is there a function to do this?

    I could very well turn the array into a comma delimited string and do a query using the string.

    inlist(WO_ID,string_of_wo_id)
    Lee Goldberg
    Software Development and Sales
    Shore Consultants Ltd.
    [email protected]
    www.shorecon.com

    #2
    Re: query table by an array

    3.) take any WO_ID in array "aLU" out of array "aWO"- Is there a function to do this or do I need to create my own
    Yes, several. First try:
    word_subtract()
    You might have to convert the arrays to lists first.
    4.) query workorder table by the array "aWO" - again is there a function to do this?
    Yes.. it escapes me at the moment, but you could:
    1-If you think the remaining array will be small, you could run one query
    2-If it is a large array, you will need to run one query after another for each row in the array.

    Which is it?

    Comment


      #3
      Re: query table by an array

      There is going to be multiple rows in the array.
      Running a query for each row just seems inefficient. but maybe I'm wrong.

      I think converting the multiple row array to a vector(string). And then run one query with the following filter.

      Would this work?

      Code:
      filter = "contains('"+String+"', alltrim(tbl.WO_ID))"
      Lee Goldberg
      Software Development and Sales
      Shore Consultants Ltd.
      [email protected]
      www.shorecon.com

      Comment


        #4
        Re: query table by an array

        There is going to be multiple rows in the array.
        I figured that.. but how many is "multiple"?
        a dozen?
        more?
        Running a query for each row just seems inefficient
        Couldn't agree more.. but if that's the only way to Rome..
        This raised a question in my mind: what happens when alpha runs a query with multiple variables? does it run several passes?
        Oviousely, if the answer is yes, then there is no difference in terms of efficency.
        I have to mull over this when I have the time..my initial thinking: several passes.

        Comment


          #5
          Re: query table by an array

          To you last question:
          Code:
          Would this work?
          filter = "contains('"+String+"', alltrim(tbl.WO_ID))"
          No and no.
          Not a chance in Mumbai.
          This filter looks like something you bought from gypsy on a street corner!
          Where did tbl. come into the picture?
          Let me guess: that's where you opened the table to get your array.
          OK.
          But the tbl and the array are distant cousins here. They don't share the same gene pool.
          You are not far off in your thinking though. You are trying to concatenate the filter which is the essence of what I refered to in case the remaining array is not too large. You could turn it into one filter. But if it is too large, you will run into expression limitations.
          P.S.
          Disregard my stupid sense of humor!
          Last edited by G Gabriel; 12-02-2008, 05:39 PM.

          Comment


            #6
            Re: query table by an array

            Perhaps the is_one_of() function would be a more flexible choice for your query filter expression. Convert the filtered array to a list first, and remember to use trimmed field values when searching the list.

            Comment


              #7
              Re: query table by an array

              So there maybe no way to filter by array....bummer. I thought the gods of alpha would have a function for that.

              The array will be anywhere from about 0 - 12 rows.

              Thats fine I can manage. Just thought it would be helpful. btw U guys are great at timely responses

              maybe i need to share alittle more detail with you fellas. Here is the problem and the logic I think necessary to solve it.

              Problem:
              The user is prompted for a date.
              A lineup record is created for that date.
              The user is again prompted to decide which work orders they want to add to the lineup.

              However, If they select a date and a lineup record already exists for that date. I only want the user to be prompted with work orders that are NOT already on the lineup for that date. (meaning when they first created the lineup I want to prompt for the work orders they did not decide to add. )

              Logic:
              Thus how i got to the conclusion to filter the lineup table and put all the work order IDs in the lineup for the selected date into an array.

              Then take all the "possible work orders" that meet the criteria to be added to the lineup and put their ID's in a seperate array. (including work order id's that are already inthe lineup)

              Subtract the Lineup Work ID's array from the Possible Work ID's to get the Work ID's not in the lineup.

              Then filter the work order table by the array of the differences and prompt the user for those work orders to be added to the existing lineup.



              Hope this isn't too confusing. I am so neck deep in this project I can't see the light.
              Lee Goldberg
              Software Development and Sales
              Shore Consultants Ltd.
              [email protected]
              www.shorecon.com

              Comment


                #8
                Re: query table by an array

                Lee, converting the filtered array to a crlf delimited list is easy, there's a built in function for it, assuming your array is one dimensional. check the help file discussion on

                <array>.dump()

                -- tom

                Comment


                  #9
                  Re: query table by an array

                  So there maybe no way to filter by array....bummer.
                  Of course there is, but you just can't take a whole swath and use it to query. You have to parse it somehow. No, you do not have to convert it to a list in order to do that. You could use the array's rows to filter with but you need to dim your array as shared or global to begin with.
                  I only mentioned converting to list when responding to the first question. word_subttract() works on a list. You could try it on an array, it might work, if not, convert the array to a list first.

                  On "mild" reflection on this, the question you want to ask or perhaps have already asked in a manner I didn't quite grab is:
                  Is there a function that subtract one array from another?
                  As far as I know, no. Certaily you can make your own which will involve converting the arrays to lists, substract, then convert the remaining list to an array. Or you could iterate one array over another deleting matching rows as you go along. It's really not that big of a deal. I didn't focus in my responses on this part as it seems you are stumped on the query part.
                  Last edited by G Gabriel; 12-02-2008, 07:34 PM.

                  Comment

                  Working...
                  X