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 do I subtract one property array from another to find the missing entries

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

    How do I subtract one property array from another to find the missing entries

    I have two property Arrays LogdataReg and DisplayReg.

    DisplayReg may or may not have the same records as LogDataReg.

    How do I subtract DisplayReg from LogDataReg to get the Missing Entries that are in LogDataReg but not in DisplayReg?

    I am only interested in the first field "REG" of each record for use in the comparison. In the sample setup the Missing Entries are "MISSING1" and "MISSING2".

    I have been trawling through Table of Contents in the Alpha Five Documentation, but cannot find anything that might do it.

    'setup test data
    dim shared DisplayData as c = <<%a%
    4X-EDM|4X-EDM||ISRAEL|01|02/10/2019|{PAGANHILL SBS}
    9H-QAC|EI-FZS||MALTA|01|19/05/2017|{PAGANHILL SBS}
    A7-ANA|A7-ANA||QATAR|01|02/10/2019|{PAGANHILL SBS}
    D-ABYI|D-ABYI||GERMANY|01|16/03/2014|{PAGANHILL SBS}
    EC-MII|EC-MII||SPAIN|01|02/10/2019|{PAGANHILL SBS}
    EI-EKX|EI-EKX||IRELAND||03/11/2016|{PAGANHILL SBS}
    EI-LRB|EI-LRB||IRELAND|01|02/10/2019|{PAGANHILL SBS}
    G-BDZD|G-BDZD||UK|01|02/10/2019|{PAGANHILL SBS}
    G-BOYF|G-BOYF||UK|01|02/10/2019|{PAGANHILL SBS}
    G-IZZT|G-IZZT||UK|01|07/07/2018|KEMBLE
    G-NEOV|G-NEOV||UK|01|02/10/2019|{PAGANHILL SBS}
    G-SUEI|G-SUEI||UK|01|29/08/2019|STAVERTON
    G-XWBB|G-XWBB||UK|01|02/10/2019|{PAGANHILL SBS}
    HB-JCT|HB-JCT||SWITZERLAND|01|02/10/2019|{PAGANHILL SBS}
    N1F|N1F||USA|01|02/10/2019|{PAGANHILL SBS}
    N536LA|N536LA||COLOMBIA|01|02/10/2019|{PAGANHILL SBS}
    TC-JYM|TC-JYM||TURKEY|01|02/10/2019|{PAGANHILL SBS}
    %a%
    dim shared LogData as c = <<%a%
    MISSING1|MISSING1|||02/10/2019|01|{PAGANHILL SBS}
    MISSING2|MISSING2|||02/10/2019|01|{PAGANHILL SBS}
    4X-EDM|4X-EDM|||02/10/2019|01|{PAGANHILL SBS}
    D-ABYI|D-ABYI|||02/10/2019|01|{PAGANHILL SBS}
    A7-ANA|A7-ANA|||02/10/2019|01|{PAGANHILL SBS}
    G-NEOV|G-NEOV|||02/10/2019|01|{PAGANHILL SBS}
    N536LA|N536LA|||02/10/2019|01|{PAGANHILL SBS}
    TC-JYM|TC-JYM|||02/10/2019|01|{PAGANHILL SBS}
    EC-MII|EC-MII|||02/10/2019|01|{PAGANHILL SBS}
    9H-QAC|9H-QAC|||02/10/2019|01|{PAGANHILL SBS}
    G-BDZD|G-BDZD|||02/10/2019|01|{PAGANHILL SBS}
    EI-LRB|EI-LRB|||02/10/2019|01|{PAGANHILL SBS}
    EI-EKX|EI-EKX|||02/10/2019|01|{PAGANHILL SBS}
    G-BOYF|G-BOYF|||02/10/2019|01|{PAGANHILL SBS}
    G-IZZT|G-IZZT|||02/10/2019|01|{PAGANHILL SBS}
    G-SUEI|G-SUEI|||02/10/2019|01|{PAGANHILL SBS}
    N1F|N1F|||02/10/2019|01|{PAGANHILL SBS}
    G-XWBB|G-XWBB|||02/10/2019|01|{PAGANHILL SBS}
    HB-JCT|HB-JCT|||02/10/2019|01|{PAGANHILL SBS}
    %a%
    dd = *count(DisplayData)
    ld = *count(LogData)
    trace.clear()
    dim shared DisplayReg[dd] as p
    dim shared LogdataReg[ld] as p
    DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",DisplayData)
    LogDataReg.initialize_properties("reg|as|code|Country|H|When|where",LogData)
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    Re: How do I subtract one property array from another to find the missing entries

    Hi Graham,

    Here is one solution.
    I hope you don't mind but I did make a few changes for my sanity.
    This code will put the missing regs into the missingList.
    I changed missing1 and missing2 just to make things easier on my over-worked brain.

    Gregg
    Code:
    'setup test data
    
    dim shared DisplayReg[0] as p
    dim shared LogdataReg[0] as p
    dim shared LogData as c
    dim shared DisplayData as c 
    dim missingList as c
    dim checkList as c
    DisplayData = <<%a%
    4X-EDM|4X-EDM||ISRAEL|01|02/10/2019|{PAGANHILL SBS}
    9H-QAC|EI-FZS||MALTA|01|19/05/2017|{PAGANHILL SBS}
    A7-ANA|A7-ANA||QATAR|01|02/10/2019|{PAGANHILL SBS}
    D-ABYI|D-ABYI||GERMANY|01|16/03/2014|{PAGANHILL SBS}
    EC-MII|EC-MII||SPAIN|01|02/10/2019|{PAGANHILL SBS}
    EI-EKX|EI-EKX||IRELAND||03/11/2016|{PAGANHILL SBS}
    EI-LRB|EI-LRB||IRELAND|01|02/10/2019|{PAGANHILL SBS}
    G-BDZD|G-BDZD||UK|01|02/10/2019|{PAGANHILL SBS}
    G-BOYF|G-BOYF||UK|01|02/10/2019|{PAGANHILL SBS}
    G-IZZT|G-IZZT||UK|01|07/07/2018|KEMBLE
    G-NEOV|G-NEOV||UK|01|02/10/2019|{PAGANHILL SBS}
    G-SUEI|G-SUEI||UK|01|29/08/2019|STAVERTON
    G-XWBB|G-XWBB||UK|01|02/10/2019|{PAGANHILL SBS}
    HB-JCT|HB-JCT||SWITZERLAND|01|02/10/2019|{PAGANHILL SBS}
    N1F|N1F||USA|01|02/10/2019|{PAGANHILL SBS}
    N536LA|N536LA||COLOMBIA|01|02/10/2019|{PAGANHILL SBS}
    TC-JYM|TC-JYM||TURKEY|01|02/10/2019|{PAGANHILL SBS}
    %a%
    LogData = <<%a%
    HA-HA|HA-HA|||02/10/2019|01|{PAGANHILL SBS}
    HOA-HOA|HOA-HOA|||02/10/2019|01|{PAGANHILL SBS}
    4X-EDM|4X-EDM|||02/10/2019|01|{PAGANHILL SBS}
    D-ABYI|D-ABYI|||02/10/2019|01|{PAGANHILL SBS}
    A7-ANA|A7-ANA|||02/10/2019|01|{PAGANHILL SBS}
    G-NEOV|G-NEOV|||02/10/2019|01|{PAGANHILL SBS}
    N536LA|N536LA|||02/10/2019|01|{PAGANHILL SBS}
    TC-JYM|TC-JYM|||02/10/2019|01|{PAGANHILL SBS}
    EC-MII|EC-MII|||02/10/2019|01|{PAGANHILL SBS}
    9H-QAC|9H-QAC|||02/10/2019|01|{PAGANHILL SBS}
    G-BDZD|G-BDZD|||02/10/2019|01|{PAGANHILL SBS}
    EI-LRB|EI-LRB|||02/10/2019|01|{PAGANHILL SBS}
    EI-EKX|EI-EKX|||02/10/2019|01|{PAGANHILL SBS}
    G-BOYF|G-BOYF|||02/10/2019|01|{PAGANHILL SBS}
    G-IZZT|G-IZZT|||02/10/2019|01|{PAGANHILL SBS}
    G-SUEI|G-SUEI|||02/10/2019|01|{PAGANHILL SBS}
    N1F|N1F|||02/10/2019|01|{PAGANHILL SBS}
    G-XWBB|G-XWBB|||02/10/2019|01|{PAGANHILL SBS}
    HB-JCT|HB-JCT|||02/10/2019|01|{PAGANHILL SBS}
    %a%
    '''dd = *count(DisplayData)
    '''ld = *count(LogData)
    '''trace.clear()
    DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",DisplayData)
    LogDataReg.initialize_properties("reg|as|code|Country|H|When|where",LogData) 
    LogdataReg.sort("A","reg")
    DisplayReg.sort("A","reg")
    
    for n = 1 to LogdataReg.size()
    	checkList = checkList+ LogdataReg[n].reg+crlf()
    next n
    debug(1)
    
    for each logreg in checkList
    	if DisplayReg.findI(logreg.value,"reg")=0 then
    		missingList = missingList+logreg.value+crlf()
    	end if
    next
    end
    Gregg
    https://paiza.io is a great site to test and share sql code

    Comment


      #3
      Re: How do I subtract one property array from another to find the missing entries

      Thanks Gregg,

      nearly there.

      My Fault, I should have said that although I am only interested in the first field "REG" of each record for use in the comparison, I require the whole record to be in the Missing Entries array, not just the REG field.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        Re: How do I subtract one property array from another to find the missing entries

        Stumbled upon my own solution:

        Code:
        dim shared MyDisplayReg as U
        dim shared MyLogdataReg as U
        dim shared MissingReg[0] as c
        MyDisplayReg.initialize("1|2|3|4|5|6","1","1|2|3|4|5|6",DisplayData)
        MyLogDataReg.initialize("1|2|3|4|5|6","1","1|2|3|4|5|6",LogData)
        	KeyVal = myLogDataReg.first()
        	for n = 1 to MyLogdataReg.size()
        			Data = MyLogdataReg.get(KeyVal)
        			if .not. MyDisplayReg.exist(word(data,1,"|")) then
        				MissingReg[] = Data
        			end if	
        			KeyVal = MyLogdataReg.next(KeyVal)
        	next
        showvar(MissingReg.dump())
        --
        Support your local Search and Rescue Unit, Get Lost!

        www.westrowops.co.uk

        Comment


          #5
          Re: How do I subtract one property array from another to find the missing entries

          ok...just a minor change.
          Try this code.
          [code]
          DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",DisplayData)
          LogDataReg.initialize_properties("reg|as|code|Country|H|When|where",LogData)
          '''LogdataReg.sort("A","reg")
          '''DisplayReg.sort("A","reg")
          '''for n = 1 to LogdataReg.size()
          ''' checkList = checkList+ LogdataReg[n].reg+"|"+convert_type(n,"C")+crlf()
          '''next n

          for each logreg in LogData
          ''' if DisplayReg.findI(logreg.value,"reg")=0 then
          if DisplayReg.findI(left(logreg.value,at("|",logreg.value)-1),"reg")=0 then
          missingList = missingList+logreg.value+crlf()
          end if
          next
          debug(1)
          ' The code below will add the missing items to the DisplayReg array.
          '''DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",missingList,.t.)

          ' Uncomment the code below here to verify the missing data as been added to DisplayReg array.
          '''missingList = ""
          '''for each logreg in LogData
          ''' if DisplayReg.findI(left(logreg.value,at("|",logreg.value)-1),"reg")=0 then
          ''' missingList = missingList+logreg.value+crlf()
          ''' end if
          '''next
          end
          [\code]
          Gregg
          https://paiza.io is a great site to test and share sql code

          Comment


            #6
            Re: How do I subtract one property array from another to find the missing entries

            Graham,

            Sometimes my best efforts are afterthoughts.
            This (in my opinion) is cleaner and easier to follow.
            I presumed you were going to add the missing logdataregs to the displayRegs, so I included the code to do that.

            Code:
            'setup test data
            
            dim shared DisplayReg[0] as p
            dim shared LogdataReg[0] as p
            dim shared LogData as c
            dim shared DisplayData as c 
            dim missingList as c
            dim checkList as c
            dim testList as c
            DisplayData = <<%a%
            4X-EDM|4X-EDM||ISRAEL|01|02/10/2019|{PAGANHILL SBS}
            9H-QAC|EI-FZS||MALTA|01|19/05/2017|{PAGANHILL SBS}
            A7-ANA|A7-ANA||QATAR|01|02/10/2019|{PAGANHILL SBS}
            D-ABYI|D-ABYI||GERMANY|01|16/03/2014|{PAGANHILL SBS}
            EC-MII|EC-MII||SPAIN|01|02/10/2019|{PAGANHILL SBS}
            EI-EKX|EI-EKX||IRELAND||03/11/2016|{PAGANHILL SBS}
            EI-LRB|EI-LRB||IRELAND|01|02/10/2019|{PAGANHILL SBS}
            G-BDZD|G-BDZD||UK|01|02/10/2019|{PAGANHILL SBS}
            G-BOYF|G-BOYF||UK|01|02/10/2019|{PAGANHILL SBS}
            G-IZZT|G-IZZT||UK|01|07/07/2018|KEMBLE
            G-NEOV|G-NEOV||UK|01|02/10/2019|{PAGANHILL SBS}
            G-SUEI|G-SUEI||UK|01|29/08/2019|STAVERTON
            G-XWBB|G-XWBB||UK|01|02/10/2019|{PAGANHILL SBS}
            HB-JCT|HB-JCT||SWITZERLAND|01|02/10/2019|{PAGANHILL SBS}
            N1F|N1F||USA|01|02/10/2019|{PAGANHILL SBS}
            N536LA|N536LA||COLOMBIA|01|02/10/2019|{PAGANHILL SBS}
            TC-JYM|TC-JYM||TURKEY|01|02/10/2019|{PAGANHILL SBS}
            %a%
            LogData = <<%a%
            HA-HA|HA-HA|||02/10/2019|01|{PAGANHILL SBS}
            HOA-HOA|HOA-HOA|||02/10/2019|01|{PAGANHILL SBS}
            4X-EDM|4X-EDM|||02/10/2019|01|{PAGANHILL SBS}
            D-ABYI|D-ABYI|||02/10/2019|01|{PAGANHILL SBS}
            A7-ANA|A7-ANA|||02/10/2019|01|{PAGANHILL SBS}
            G-NEOV|G-NEOV|||02/10/2019|01|{PAGANHILL SBS}
            N536LA|N536LA|||02/10/2019|01|{PAGANHILL SBS}
            TC-JYM|TC-JYM|||02/10/2019|01|{PAGANHILL SBS}
            EC-MII|EC-MII|||02/10/2019|01|{PAGANHILL SBS}
            9H-QAC|9H-QAC|||02/10/2019|01|{PAGANHILL SBS}
            G-BDZD|G-BDZD|||02/10/2019|01|{PAGANHILL SBS}
            EI-LRB|EI-LRB|||02/10/2019|01|{PAGANHILL SBS}
            EI-EKX|EI-EKX|||02/10/2019|01|{PAGANHILL SBS}
            G-BOYF|G-BOYF|||02/10/2019|01|{PAGANHILL SBS}
            G-IZZT|G-IZZT|||02/10/2019|01|{PAGANHILL SBS}
            G-SUEI|G-SUEI|||02/10/2019|01|{PAGANHILL SBS}
            N1F|N1F|||02/10/2019|01|{PAGANHILL SBS}
            G-XWBB|G-XWBB|||02/10/2019|01|{PAGANHILL SBS}
            HB-JCT|HB-JCT|||02/10/2019|01|{PAGANHILL SBS}
            %a%
            '''dd = *count(DisplayData)
            '''ld = *count(LogData)
            '''trace.clear()
            DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",DisplayData)
            LogDataReg.initialize_properties("reg|as|code|Country|H|When|where",LogData) 
            
            for n = 1 to LogdataReg.size()
            	if DisplayReg.findI(LogdataReg[n].reg,"reg")=0 then	
            		missingList = missingList+LogdataReg[n].reg+ "|" +LogdataReg[n].as+ "|" +LogdataReg[n].code+ "|" +LogdataReg[n].Country+ "|" +LogdataReg[n].H+ "|" +LogdataReg[n].When+ "|" +LogdataReg[n].Where+crlf()
            	end if
            next n
            debug(1)
            ' The code below will add the missing items to the DisplayReg array.
            DisplayReg.initialize_properties("reg|as|code|Country|H|When|where",missingList,.t.)
            end
            Gregg
            https://paiza.io is a great site to test and share sql code

            Comment

            Working...
            X