I.T. Discussion Community!
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardParadox Forms Topic   Print This     

Set Range/Pattern Match

Set Range/Pattern Match in Paradox Forms topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: Range/Pattern   Set Range/Pattern   Set Range/Pattern Match  
PS_1600
Atlantic Electrical Supply Cor
-- USA

I am working with a PDX8 program which uses Wahl2Wahl's table lookups which work very well. The table lookups do not function correctly on PDX10, the up/down arrows and tab do not work. I am trying to create something similar and combining  set range and locate pattern. I can get either to work but not together. Is there a way to code in such a way that the setRange is the default but the user can also type .. to enable the locate pattern logic?

method keyPhysical(var eventInfo KeyEvent)

Var
  s  string
endVar
    doDefault
 
     s = self.value
    
     ;PART.setRange( self.value, self.value+"zzz" )
  
      ignoreCaseInStringCompares(yes)
      advancedWildcardsInLocate(Yes)


      PART.locatePattern("DESC",s)
 
endmethod

Thanks.

Steve

 Posted 40 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17474, 19 replies
Thread Started 4/16/2019 1:05:46 PM
View Counter=168
Last Reply Posted 4/25/2019 5:02:24 PM)
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

is the locate returning false? or skipping out of the setrange?

wrap it in an "if not" and a message

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 40 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17475 (Level 2) and Parent is 17474
Reply Posted 4/16/2019 1:30:05 PM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

If I comment out the setRange as is the Part.locatePattern("DESC",S) works fine.  The issue is that it is slow searching the entire data string of 20,000+ records. If I comment out everything but the setRange line it's much faster but unless you know exactly what you are searching case wise and other wise you don't find the record you are looking for.

 Posted 40 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17476 (Level 3) and Parent is 17474
Reply Posted 4/16/2019 1:37:40 PM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

again.. if you put the setrange back in, does the locate return false?

setrange()

if not locatepattern() then msginfo() endif

the problem with any pattern search is, it starts from the beginning, so it's always slow on a large table.. a switchindex() first, to an index on that field, might help, too.. it all depends on context

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 40 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17477 (Level 4) and Parent is 17474
Reply Posted 4/16/2019 1:49:29 PM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

I am trying to modify Steve Caple's locate code. When I put the setrange statement in everything works as expected. The tableframe which is populated with data narrows the choice of records. When I include the locatepattern search without the setrange staement that too works. What I am trying to do is find a way to toggle between the two search methods using either a keyboard macro such as ctrl-a or toggle by entering a key pattern such as the traditional .. Wahl2Wahl's ezdialogs table lookup did this so seamlessly allowying you to search from the beginning of the string, ignoring case, or by keying .. to do a pattern search. It's a shame that this product doesn't work well in PDX10.

 Posted 40 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17478 (Level 5) and Parent is 17474
Reply Posted 4/16/2019 5:56:48 PM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

I never used any of the common 3rd party tool boxes.. mostly have my own.. conceptually, nothing much has changed over the years, just adding functionality.. does W2W give you an error? do you need to re-compile its' library?

I thought you were trying to use the locate within the setrange.. my bad.. if it's either/or, you can set a var that tells you which is active, so you can switch to the other

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 39 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17479 (Level 6) and Parent is 17474
Reply Posted 4/17/2019 6:39:41 AM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

It's been a long time since I have done any programming with PDX. Moving to Win10 is forcing the issue. I can't recompile the W2W library because he has it locked down as compiled already. The W2W lookup do not fail in PDX10 on W10 but the navigation keys do not function. The up/down arrows and tab do not allow you easily select a record from the array. However, you can scroll with the mouse and click on a record to select it which is cumbersome doing a lot of data entry.

Back to the question at hand. I would like to be able to do a locate within the set range but that does not seem to be possilbe. As an alternate switching between setrange and locatepattern would help. What would the code look like to do this? How can I set a variable to specify and select this? Can a keyboard macro be programmed or a .. to initiate locatepattern?

Thanks.

 Posted 39 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17480 (Level 7) and Parent is 17474
Reply Posted 4/17/2019 6:54:12 AM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

only ldl files? no lsl files?

depending on the scope of your context (will it be one field, one form, everywhere?), there are different ways to do this.. it was in a library, written in a manner that you could use universally

off the top of my head.. you'd need a var in your Vars on the form, set an initial value for the var in your Open, establish a hot-key that'll toggle thru the options in KeyPhysical and/or add these to a menu, etc.

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 39 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17481 (Level 8) and Parent is 17474
Reply Posted 4/17/2019 7:10:25 AM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

That makes sense. What would the code look like to esatablish a hot key? never done that before?

 Posted 39 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17482 (Level 9) and Parent is 17474
Reply Posted 4/17/2019 7:22:35 AM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

simple examples

if EVENTINFO.VCHAR()="VK_F9" then

; traps for F9 key

 if #Formdata1.isedit() and EVENTINFO.ISCONTROLKEYDOWN() AND EVENTINFO.VCHARCODE() = VK_DELETE THEN   

; traps for an attempt to delete, in edit mode

there are several ways to trap for a keystroke.. what you do or don't do, after that, can be anything

sorry, but I don't have too much time to answer questions today

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 39 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17483 (Level 10) and Parent is 17474
Reply Posted 4/17/2019 7:37:40 AM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
rum
Frankfort, KY USA

I also use WahltoWahl EZDialog.   I lost my arrow key functionality when I converted to Pdox11. Spoke with them  no chance of getting support.

It looks like you are searching only one field...Does the data have a primary key?

If so, could you load the data into a string array with the key being the index at the same time you load the table grid?

Then do the search in the array and build a filter of keys which you tehn apply to the table grid tcursor with setGenFilter

....Just a crazy thought,  i might try it for my issue.

Jeff

 Posted 39 days ago
Comment Quote
About rum -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17484 (Level 11) and Parent is 17474
Reply Posted 4/17/2019 1:31:57 PM
Location=Frankfort, KY USA 
Joined=23 months ago   MB Posts=79  
Moderator
Steven.G
Myrtle Beach, SC USA

we did a lot of stuff with dynarrays like that

dyn["this"] = "that"

pre-loading lookup table values, employee/item details, etc.. copytodynarray is an easily replicated and often overlooked concept

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 39 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17485 (Level 12) and Parent is 17474
Reply Posted 4/17/2019 2:16:33 PM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

Thanks for the help. The dynarray is a good idea. Question: How do you attach a dynarray to a table frame to display the data? I have created a tableframe called Selection. I want to display two fields, Description and Cost from my parts.db table but am unsure how to do this. Any help would be appreciated.

 Posted 34 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17488 (Level 13) and Parent is 17474
Reply Posted 4/22/2019 5:34:00 AM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

in this case, sounds like you've made the dyn, you'd want to scan the table to populate it from the dyn

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 34 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17489 (Level 14) and Parent is 17474
Reply Posted 4/22/2019 5:40:08 AM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
Moderator
Steven.G
Myrtle Beach, SC USA

sorry, wrong.. something like this

foreach element in the dyn

  insertrecord()

  this field = element

  that field = dyn[element]

endforeach

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 34 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17490 (Level 15) and Parent is 17474
Reply Posted 4/22/2019 5:42:48 AM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
rum
Frankfort, KY USA

When the user enters the search criteria and you have located the possible matches in the dynArray,  build a filter for setGenFilter and apply  it to the tcursor which supplies the table frame with data.   

If that responds quick enough then you are done....if not, i might try an alternate search results table,  depends on the lookup situation.


 Posted 34 days ago
Comment Quote
About rum -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17491 (Level 16) and Parent is 17474
Reply Posted 4/22/2019 6:29:27 AM
Location=Frankfort, KY USA 
Joined=23 months ago   MB Posts=79  
PS_1600
Atlantic Electrical Supply Cor
-- USA

I am having troble populating the tableframe. I see the first record in the tableframe only. When I click on the visible record it shows 1 of 19000 but nothing else shows. My code is as follows. What am I missing?

method open(var eventInfo Event)
Var
    dyn DynArray[] AnyType
    tc  Tcursor
    ar Array[] string
    
endvar

 
 tc.open(":salesdata:Part.db")
 tc.copyToArray(dyn)
 
 insertrecord()
 PartTF.Desc = dyn["Desc"]
 PartTF.LIST = dyn["List"]
 PartTF.Manufacturer = dyn["Manufacturer"]

 tc.close()

endMethod

 Posted 33 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17492 (Level 17) and Parent is 17474
Reply Posted 4/23/2019 12:36:41 PM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Moderator
Steven.G
Myrtle Beach, SC USA

you are only passing one record from Part table to whatever table is in the tableframe.. that is completely different from anything we have been discussing, I think

Steven Green
Senior Software Engineer
Paradox Support Specialist DOS/WIN

Prestwood IT Solutions
8421 Auburn Blvd, Suite 256, Citrus Heights, CA 95610
Office: 916-726-5675 | Fax: 916-726-5676 | http://www.prestwood.com
 Posted 33 days ago
Comment Quote
About Steven.G -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #17493 (Level 18) and Parent is 17474
Reply Posted 4/23/2019 1:31:00 PM
Location=Myrtle Beach, SC USA 
Joined=32 months ago   MB Posts=264  
PS_1600
Atlantic Electrical Supply Cor
-- USA

I have created a tableframe with 3 undefined fields which I have named Desc, List and Manufacturer which correspond to the elements in the dynArray. If I can get the dynarray to populate my tableframe my search issues, I hope, will be resolved. I have read everything I can find on dynarrays in the objecpal help and in my dusty old Guide to ObjectPal. The documentation is definitely lacking.  Would you be good enough to provide me the additions to my code which will allow my to populate the tableframe from a dynarray which gets its elements from my parts table. I am stumped on this one.

Again, my code which I have thus far which only puts the first record in the tableframe is as follows:

method open(var eventInfo Event)
Var
    dyn DynArray[] AnyType
    tc  Tcursor
    ar Array[] string
    
endvar

 
 tc.open(":salesdata:Part.db")
 tc.copyToArray(dyn)
 
 insertrecord()
 PartTF.Desc = dyn["Desc"]
 PartTF.LIST = dyn["List"]
 PartTF.Manufacturer = dyn["Manufacturer"]

 tc.close()

endMethod

Thanks.

 Posted 32 days ago (Thread Starter)
Comment Quote
About PS_1600 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17494 (Level 19) and Parent is 17474
Reply Posted 4/24/2019 5:14:55 AM
Location=-- USA 
Joined=40 days ago   MB Posts=8  
Most Recent Post
rum
Frankfort, KY USA

I will take a stab at it, Unfortunately,I am on vacation this week.


send a a few sample records, as well as a rough count on how many records you will be searching. I will use that info to create something. Keep in mind, I have never done this, I only presume that I can do it, AND since I have a similar issue will give it a shot.


Jeff

 Posted 31 days ago
Comment Quote
About rum -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread with a verified email.
Member pending approval.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #17496 (Level 20) and Parent is 17474
Reply Posted 4/25/2019 5:01:39 PM
Location=Frankfort, KY USA 
Joined=23 months ago   MB Posts=79  
Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1261A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #17474 Counter
168
Since 4/16/2019
Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech