d3 Basic Wildcard Character

322 views
Skip to first unread message

Robert S. Lobel

unread,
Sep 18, 2014, 11:54:46 AM9/18/14
to mvd...@googlegroups.com
In d3 Access, the caret (^) is a wildcard character.  Is there a corresponding wildcard character in d3 Basic?

Nathan Rector

unread,
Sep 18, 2014, 11:56:50 AM9/18/14
to mvd...@googlegroups.com
Can you provide sample code for what you are trying to do?

My first thought would be to use MATCHES, but it would depend on your
example.


--------------------------------------------
Nathan Rector
International Spectrum, Inc
http://www.intl-spectrum.com
Phone: 720-259-1356

Robert S. Lobel

unread,
Sep 18, 2014, 1:01:23 PM9/18/14
to mvd...@googlegroups.com
Need to capture IDs 71##### and 771#### and 772####, ideally with one command.

Nathan Rector

unread,
Sep 18, 2014, 1:30:22 PM9/18/14
to mvd...@googlegroups.com
There are 2 ways to do this:

IF ID[1,2] = "71" OR ID[1,3] = "771" OR ID[1,3] = "772" THEN
...
END

or

IF ID MATCHES "'71'5N" OR ID MATCHES "'771'4N" OR ID MATCHES "'771'4N" THEN
...
END

This is look for a prefix of 71 or 771, and then look for x number of of
numeric chars after that (5N = 5 numeric chars). If you change the 'N'
to an 'X' then it will look for any kind of character.

Anyone else have a suggestion?


--

Anthony Youngman

unread,
Sep 18, 2014, 1:40:54 PM9/18/14
to mvd...@googlegroups.com
On 18/09/14 18:29, Nathan Rector wrote:
> There are 2 ways to do this:
>
> IF ID[1,2] = "71" OR ID[1,3] = "771" OR ID[1,3] = "772" THEN
> ...
> END
>
> or
>
> IF ID MATCHES "'71'5N" OR ID MATCHES "'771'4N" OR ID MATCHES "'771'4N" THEN
> ...
> END
>
> This is look for a prefix of 71 or 771, and then look for x number of of
> numeric chars after that (5N = 5 numeric chars). If you change the 'N'
> to an 'X' then it will look for any kind of character.
>
> Anyone else have a suggestion?
>
>
Yup. Almost the same as yours, and it's UV basic but I guess D3 would be
the same ...

IF ID MATCHES "'71'5N" :@VM: "'771'4N" :@VM: "'771'4N" THEN

Cheers,
Wol

Robert S. Lobel

unread,
Sep 19, 2014, 10:50:23 AM9/19/14
to mvd...@googlegroups.com
In other words, I assume that there isn't a corresponding wildcard character in d3 Basic.


On Thursday, September 18, 2014 8:54:46 AM UTC-7, Robert S. Lobel wrote:

Charlie Noah

unread,
Sep 19, 2014, 11:13:02 AM9/19/14
to mvd...@googlegroups.com
Hi Robert,

I would be shocked if D3 didn't support the caret wildcard. It's been an integral part of Pick back as far as I can remember (Microdata days).

Charlie
--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms

geneb

unread,
Sep 19, 2014, 11:23:26 AM9/19/14
to mvd...@googlegroups.com
On Fri, 19 Sep 2014, Charlie Noah wrote:

> Hi Robert,
>
> I would be shocked if D3 didn't support the caret wildcard. It's been an
> integral part of Pick back as far as I can remember (Microdata days).
>
Just for giggles I tried a select using ^ and it works fine.

select customers with a0 = 1^^4

returned all the entries with an a0 starting with 1, any 2 characters and
ended with a 4.

I'm using D3 Linux v9.0

g.

--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby. Geeks collect hobbies.

ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://scarlet.deltasoft.com - Get it _today_!

Tony Gravagno

unread,
Sep 19, 2014, 11:37:02 AM9/19/14
to mvd...@googlegroups.com
Or:
PREFIXES = ""
PREFIXES<2> = CHANGE("71 83 96"," ",@VM) ; * two-character prefixes
PREFIXES<3> = CHANGE("771 843 946"," ",@VM) ; * three-character prefixes
* The Change is just a convenient way to convert space-delimited data to VM-delimited
FOR CHARS = 2 TO 3
   LOCATE(ID[1,CHARS],PREFIXES,CHARS;POS) THEN ; * matched!

Not elegant? Well, it's about as elegant as a bunch of IF clauses...

If the number of characters is consistent (not 71 and 771, but Only 2 chars or Only 3 chars), there's also this:
IFR PREFIXES<2> = ID<2>[1,2]
The IFR statement returns true of the second argument is present in any element of the first argument. Put that into a loop as above to replace the hardcoded '2' with a variable number of characters.

More concisely however, it's not a big deal to create a %function which does something like this:

IF %matches(ID,REGEXP.PATTERN) THEN ...

So does D3 BASIC support wildcards? Well, yeah, but it's more like a frozen pizza than take-out - everything is there, you just need to cook it yourself.



--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+unsub...@googlegroups.com

Tony Gravagno

unread,
Sep 19, 2014, 11:40:13 AM9/19/14
to mvd...@googlegroups.com
But he's looking for the equivalent of:

IF ID MATCHES "1^^4" THEN ...

Scott Johnston

unread,
Sep 22, 2014, 9:50:46 AM9/22/14
to mvd...@googlegroups.com
Very cool and good to know! Did you prove this by another method?

Tony Gravagno

unread,
Sep 22, 2014, 3:41:58 PM9/22/14
to mvd...@googlegroups.com

Scott Johnston wrote:
>Very cool and good to know! Did you prove this by another method?


Um, which part? LOL  Any part can be proven with some code. As to my suggestion about "something like" %matches, yeah, on that one I did take some time to write up a COM Automation example (see D3Ref). The way I wrote it, it only works with D3/Windows because I wanted to do a quick prototype with C# rather than try to write something more generic with C.

But the bottom line is that if a function doesn't exist natively in any of these MV platforms, I don't try to translate some perfectly good external function into BASIC. I usually prefer to make use of the DBMS interfaces which allow us to call out for the required function. To be clear, I don't write clients for HTTP, SMTP, or other protocols in BASIC, nor do I think it's necessary to expect each DBMS vendor to provide us with a Regular Expression processor. I use the tools that are in the DBMS for linking with easily obtainable, stable, and complex code libraries that already do this stuff.

HTH
T
Reply all
Reply to author
Forward
0 new messages