Discussion:
Urgent:: How to use regular expressions in x++
(too old to reply)
Preeti Sonambekar
2010-04-21 20:48:04 UTC
Permalink
Hi All,

I want to do something like this.

static void Job2(Args _args)
{
custtable custtable;
;
select * from custtable
where (custtable.countryregionid like 'US' || custtable.countryregionid like
'CA' || custtable.countryregionid like '')
&& (custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]' || custtable.zipcode
like '[A-Z]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9]');
}

But it gives error for the regular expreesions. How to achieve this?

Thanks,
Preeti
sams
2010-04-22 01:54:01 UTC
Permalink
Hi Preeti,
You could declare the regex as a variables and then use match().
Something like this

static void Job2(Args _args)
{
custtable custtable;
str regExZip1 = '[0-9][0-9][0-9][0-9][0-9]';
;
select * from custtable
where (custtable.countryregionid like 'US'
|| custtable.countryregionid like 'CA'
|| custtable.countryregionid like '');

if (match(regExZip1, custTable.ZipCode)
{
//do something
}
}
Preeti Sonambekar
2010-04-22 15:45:01 UTC
Permalink
Thanks so much for replying back. But declaring variable is possible in x++
editor. Whereas I am going to call this select using .net business connecor
and I don't know if there is any way I can declare this variable.
I would be doing something like this:

CusttableRecord.ExecuteStmt("select.....");

And I don't know where I can declare this variable?

Please suggest.

Thanks,
Preeti
Post by Preeti Sonambekar
Hi All,
I want to do something like this.
static void Job2(Args _args)
{
custtable custtable;
;
select * from custtable
where (custtable.countryregionid like 'US' || custtable.countryregionid like
'CA' || custtable.countryregionid like '')
&& (custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]' || custtable.zipcode
like '[A-Z]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9]');
}
But it gives error for the regular expreesions. How to achieve this?
Thanks,
Preeti
sams
2010-04-23 02:21:01 UTC
Permalink
Hi Preeeti,
This page looks like a good starting
point....http://msdn.microsoft.com/en-us/library/cc197126.aspx.
Hope this helps.
Post by Preeti Sonambekar
Thanks so much for replying back. But declaring variable is possible in x++
editor. Whereas I am going to call this select using .net business connecor
and I don't know if there is any way I can declare this variable.
CusttableRecord.ExecuteStmt("select.....");
And I don't know where I can declare this variable?
Please suggest.
Thanks,
Preeti
Post by Preeti Sonambekar
Hi All,
I want to do something like this.
static void Job2(Args _args)
{
custtable custtable;
;
select * from custtable
where (custtable.countryregionid like 'US' || custtable.countryregionid like
'CA' || custtable.countryregionid like '')
&& (custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]' || custtable.zipcode
like '[A-Z]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9]');
}
But it gives error for the regular expreesions. How to achieve this?
Thanks,
Preeti
Axaprojects
2010-11-15 10:57:00 UTC
Permalink
Test
Post by Preeti Sonambekar
Hi All,
I want to do something like this.
static void Job2(Args _args)
{
custtable custtable;
;
select * from custtable
where (custtable.countryregionid like 'US' || custtable.countryregionid like
'CA' || custtable.countryregionid like '')
&& (custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]' || custtable.zipcode
like '[A-Z]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
|| custtable.zipcode like '[0-9][0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9]');
}
But it gives error for the regular expreesions. How to achieve this?
Thanks,
Preeti
Post by sams
Hi Preeti,
You could declare the regex as a variables and then use match().
Something like this
static void Job2(Args _args)
{
custtable custtable;
str regExZip1 = '[0-9][0-9][0-9][0-9][0-9]';
;
select * from custtable
where (custtable.countryregionid like 'US'
|| custtable.countryregionid like 'CA'
|| custtable.countryregionid like '');
if (match(regExZip1, custTable.ZipCode)
{
//do something
}
}
Post by Preeti Sonambekar
Thanks so much for replying back. But declaring variable is possible in x++
editor. Whereas I am going to call this select using .net business connecor
and I do not know if there is any way I can declare this variable.
CusttableRecord.ExecuteStmt("select.....");
And I do not know where I can declare this variable?
Please suggest.
Thanks,
Preeti
Post by sams
Hi Preeeti,
This page looks like a good starting
point....http://msdn.microsoft.com/en-us/library/cc197126.aspx.
Hope this helps.
Submitted via EggHeadCafe
Microsoft .NET DataBase Access For Beginners
http://www.eggheadcafe.com/training-topic-area/Microsoft-NET-DataBase-Access/1/SQL-Server-Oracle-DB2-Informix-Query-Samples.aspx
Loading...