Subscribe to this thread
Home - General / All posts - ECMAscript reference
dyalsjas96 post(s)
#07-Feb-18 19:33

I'm trying to work through another Fehily text listing(query); self-learning is always fun.

The objective of the query is to match a text string (case is immaterial).

If I have read the Command Windows topics correctly, I need to understand how to compose an ECMAscript compliant text string.

Unfortunately, I'm not able to extrapolate all the understanding I need from the Manifold help webpages.

Can someone point me toward a resource that would help me learn how to compose ECMAscript compliant strings?

tjhb

8,168 post(s)
#07-Feb-18 22:40

I need to understand how to compose an ECMAscript compliant text string

Are you sure? Which Manifold topics are you looking at, which Fehily listing are you working through?

Are you wanting to apply RegExp tests, or just to make direct text comparisons (with or without LIKE)?

In other words, more detail...

dyalsjas96 post(s)
#07-Feb-18 23:05

I'm looking at the Command Window topics in the Manifold help file and the RegExp tests.

The Fehily topic is Changing String Case with UPPER and LOWER using the SQL Database Programming 2016 5.16 text listing. Listing follows:

SELECT title_name

FROM titles

WHERE UPPER(title_name) LIKE '%MO%';

I was able to get the correct output using the following text listing:

SELECT [title_name]

FROM [titles]

WHERE StringContainsCollate([title_name], 'mo', Collate('en-US', NOT true, NOT false, NOT false));

In that Fehily has a later topic on COLLATE, I'm not sure I've reached the object of the exercise, and the LIKE '%MO%' at the end of the Fehily text listing looked like part of a regular expression; so I started looking for ECMAscript references.

Thanks for the coaching.

tjhb

8,168 post(s)
#07-Feb-18 23:27

I would address ordinary comparions first, and LIKE comparisons second, ... and leave regular expressions for another day. They are much more complex (much more powerful as well), a separate topic in their own right.

adamw

8,037 post(s)
#08-Feb-18 07:09

The analog of UPPER is StringToUpperCase.

This should work:

--SQL9

SELECT title_name

FROM titles

WHERE StringToUpperCase(title_name) LIKE '%MO%';

The analog of LOWER is StringToLowerCase.

adamw

8,037 post(s)
#08-Feb-18 07:15

Also:

The syntax for regular expressions (because I think you are looking for that) is described in the Basics - Regular Expressions help topic.

There are many other sources for that on the web, but there are multiple flavors of regular expressions with small differences, the help topic describes which flavor is used in 9.

dyalsjas96 post(s)
#08-Feb-18 12:42

In your text listing above, and from the Fehily text I was presuming that '%MO%' was a scrap of regular expression; or that the % symbol was an escape character. Now I see that it is a wildcard character for the LIKE operator.

Hmmm, now to understand why StringToUpperCase and LIKE with wildcards will select upper and lower case characters.

Thank you!!!

lionel

457 post(s)
#08-Feb-18 01:32

strange to see the term ecmascript in SQL ....

see Template literals - JavaScript | MDN


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.