[BR_forum] BR 4.2: STR2MAT and MAT2STR

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Max Rubow

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Max Rubow »

Do you still have access to LORICA functions? TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files.  For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA  01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.



From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all!  use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to.  check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested.  They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet...   hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com> wrote:

don't fear using the wiki.  if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping).  just
do your best.  don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat.  usually what i do in these cases is
make the pages, cut and paste the text from the release notes  [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it  such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2?  I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://ads.net/mailman/listinfo/br_forum_ads.net
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Gabriel »

Thank you David, Luis, and George!
 
I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.
 
That is, the CSV file will have something like:
 
"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"
"C",14,"Peter Fonda","ATTN: Jane
1125 S Davis St","Arlington","TX"
"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"
"C",16,"George Clooney","P.O. Box 127
Somewhere Ave","Arlington","TX"
"C",17,"Billy Joel","1115 Benge","Arlington","TX"
 
Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?
 
I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.
 
I'm going to try the functions you sent me and see how far we get.
 
Gabriel


On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions?  TONS of encapsulated
behaviors there from years of work.


On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files.  For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA  01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.



From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all!  use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to.  check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested.  They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet...   hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com (gothnerd@gmail.com)> wrote:

don't fear using the wiki.  if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping).  just
do your best.  don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat.  usually what i do in these cases is
make the pages, cut and paste the text from the release notes  [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it  such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2?  I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Susan Smith »

Hi Gabriel,

Can you get rid of those embedded CRs by reading in the entire file in ONE big chunk in BR 4.2, create a cleaned up file without the CRs to use with the CSV parsing routines?

OPEN #1: "name=FILENAME,eol=none",DISPLAY,INPUT
LET filelength=LREC(1)

Then in BR 4.2, dim a variable the size of filelength, open the file and read it in one read stmt into your big variable, loop through the variable searching for instances of '"C"' with a POS statement to find the start of each line, break off those lines and "print" to a new display file, SREPing out the CRs first. THEN you can LINPUT it back in. Would that work?

-- Susan

Gabriel Bakker wrote:
Thank you David, Luis, and George!
 
I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.
 
That is, the CSV file will have something like:
 
"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"
"C",14,"Peter Fonda","ATTN: Jane
1125 S Davis St","Arlington","TX"
"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"
"C",16,"George Clooney","P.O. Box 127
Somewhere Ave","Arlington","TX"
"C",17,"Billy Joel","1115 Benge","Arlington","TX"
 
Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?
 
I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.
 
I'm going to try the functions you sent me and see how far we get.
 
Gabriel


On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions?  TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote: _______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net




_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
Larry

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Larry »

Where is the embedded carriage return?


From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Gabriel Bakker
Sent: Wednesday, May 13, 2009 9:38 AM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR


Thank you David, Luis, and George!



I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.



That is, the CSV file will have something like:



"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"

"C",14,"Peter Fonda","ATTN: Jane

1125 S Davis St","Arlington","TX"

"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"

"C",16,"George Clooney","P.O. Box 127

Somewhere Ave","Arlington","TX"

"C",17,"Billy Joel","1115 Benge","Arlington","TX"



Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?



I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.



I'm going to try the functions you sent me and see how far we get.



Gabriel

On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions? TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files. For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.



From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all! use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to. check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested. They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet... hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com (gothnerd@gmail.com)> wrote:

don't fear using the wiki. if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping). just
do your best. don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat. usually what i do in these cases is
make the pages, cut and paste the text from the release notes [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2? I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by John »

It’s at the end of line 2 in his example.

From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Larry
Sent: Wednesday, May 13, 2009 10:06 AM
To: 'Business Rules Forum'
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



Where is the embedded carriage return?


From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Gabriel Bakker
Sent: Wednesday, May 13, 2009 9:38 AM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR


Thank you David, Luis, and George!



I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.



That is, the CSV file will have something like:



"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"

"C",14,"Peter Fonda","ATTN: Jane

1125 S Davis St","Arlington","TX"

"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"

"C",16,"George Clooney","P.O. Box 127

Somewhere Ave","Arlington","TX"

"C",17,"Billy Joel","1115 Benge","Arlington","TX"



Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?



I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.



I'm going to try the functions you sent me and see how far we get.



Gabriel

On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions? TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files. For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.



From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all! use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to. check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested. They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet... hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com (gothnerd@gmail.com)> wrote:

don't fear using the wiki. if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping). just
do your best. don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat. usually what i do in these cases is
make the pages, cut and paste the text from the release notes [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2? I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
John Bowman
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Gabriel »

Unfortunatly, the "C"s aren't really in my data file, I just threw together some sample data to demonstrate the problem. But you give me an idea. I wonder if I COULD get the CSV export to export a couple of blank fields or something first, so that any time I see a "<CR>,," I use it as a delimiter, and any time there is a <CR> not immediatly followed by two commas, I SREP it out and replace it with a different delimiter that won't screw up the length of the BR line.
 
Reading it in BR 4.2 is nice, it allows me to read the entire file at once, without needing to do it in chunks. They also have a number of other functions that make working with CSV files easier.
 
Thanks everyone for all your help. I'll let you know when I have it working..
 
Gabriel


On Wed, May 13, 2009 at 8:53 AM, Susan Smith <susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:
Hi Gabriel,

Can you get rid of those embedded CRs by reading in the entire file in ONE big chunk in BR 4.2, create a cleaned up file without the CRs to use with the CSV parsing routines?

OPEN #1: "name=FILENAME,eol=none",DISPLAY,INPUT
LET filelength=LREC(1)

Then in BR 4.2, dim a variable the size of filelength, open the file and read it in one read stmt into your big variable, loop through the variable searching for instances of '"C"' with a POS statement to find the start of each line, break off those lines and "print" to a new display file, SREPing out the CRs first. THEN you can LINPUT it back in. Would that work?

-- Susan

Gabriel Bakker wrote:

Thank you David, Luis, and George!
 
I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.
 
That is, the CSV file will have something like:
 
"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"
"C",14,"Peter Fonda","ATTN: Jane
1125 S Davis St","Arlington","TX"
"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"
"C",16,"George Clooney","P.O. Box 127
Somewhere Ave","Arlington","TX"
"C",17,"Billy Joel","1115 Benge","Arlington","TX"
 
Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?
 
I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.
 
I'm going to try the functions you sent me and see how far we get.
 
Gabriel


On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions?  TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote: _______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by GomezL »

This isn’t the “Complete Function”, but here is the “Magic Line” that makes multi line CRLF work in our application.


70040 LINPUT #CSV_HANDLE:ASCI$
70050 LET LEN_ASCI=LEN(ASCI$) !:
IF ASCI$(1:1)='"' AND ASCI$(LEN_ASCI:LEN_ASCI)<>'"' THEN !:
LINPUT #CSV_HANDLE: BUFF$ EOF 70080 !:
LET ASCI$=ASCI$&"|"&BUFF$ !:
GOTO 70050


ASCI$ is a line in the CRLF file.
The theory is that the 1st character MUST be a “ for each record.
In addition, the theory is that the LAST character of a RECORD must also be a “
We then “Glue” these multiple lines with a | to replace the CRLF

This theory works very nicely. Remember ASCI$ and BUFF$ need to be dimensioned to the largest possible values.

Luis I. Gomez
GomezL@CollectionSoftware.com (GomezL@CollectionSoftware.com)
1-800-435-7257
Commercial Legal Software, Inc.
http://www.CollectionSoftware.com

From: br_forum-bounces@ads.net [mailto:br_forum-bounces@ads.net] On Behalf Of Gabriel Bakker
Sent: Wednesday, May 13, 2009 10:58 AM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR


Unfortunatly, the "C"s aren't really in my data file, I just threw together some sample data to demonstrate the problem. But you give me an idea. I wonder if I COULD get the CSV export to export a couple of blank fields or something first, so that any time I see a "<CR>,," I use it as a delimiter, and any time there is a <CR> not immediatly followed by two commas, I SREP it out and replace it with a different delimiter that won't screw up the length of the BR line.



Reading it in BR 4.2 is nice, it allows me to read the entire file at once, without needing to do it in chunks. They also have a number of other functions that make working with CSV files easier.



Thanks everyone for all your help. I'll let you know when I have it working..



Gabriel

On Wed, May 13, 2009 at 8:53 AM, Susan Smith <susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:
Hi Gabriel,

Can you get rid of those embedded CRs by reading in the entire file in ONE big chunk in BR 4.2, create a cleaned up file without the CRs to use with the CSV parsing routines?

OPEN #1: "name=FILENAME,eol=none",DISPLAY,INPUT
LET filelength=LREC(1)

Then in BR 4.2, dim a variable the size of filelength, open the file and read it in one read stmt into your big variable, loop through the variable searching for instances of '"C"' with a POS statement to find the start of each line, break off those lines and "print" to a new display file, SREPing out the CRs first. THEN you can LINPUT it back in. Would that work?

-- Susan

Gabriel Bakker wrote:
Thank you David, Luis, and George!



I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.



That is, the CSV file will have something like:



"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"

"C",14,"Peter Fonda","ATTN: Jane

1125 S Davis St","Arlington","TX"

"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"

"C",16,"George Clooney","P.O. Box 127

Somewhere Ave","Arlington","TX"

"C",17,"Billy Joel","1115 Benge","Arlington","TX"



Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?



I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.



I'm going to try the functions you sent me and see how far we get.



Gabriel

On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions? TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files. For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.



From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all! use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to. check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested. They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet... hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com (gothnerd@gmail.com)> wrote:

don't fear using the wiki. if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping). just
do your best. don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat. usually what i do in these cases is
make the pages, cut and paste the text from the release notes [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2? I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net




 _______________________________________________BR_forum mailing listBR_forum@ads.nethttp://ads.net/mailman/listinfo/br_forum_ads.net 



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

[BR_forum] BR 4.2: STR2MAT and MAT2STR

Post by Gabriel »

This makes sense and it looks like the easiest to implement in my current situation.
 
It seems like it will work fine as long as the first column and the last column in the CSV file are string fields.
 
Thanks Luis.
 
Gabriel


On Wed, May 13, 2009 at 10:11 AM, Luis I. Gomez <GomezL@collectionsoftware.com (GomezL@collectionsoftware.com)> wrote:

This isn’t the “Complete Function”, but here is the “Magic Line” that makes multi line CRLF work in our application.
 
 
70040  LINPUT #CSV_HANDLE:ASCI$
70050 LET LEN_ASCI=LEN(ASCI$) !:                                                     
IF ASCI$(1:1)='"' AND ASCI$(LEN_ASCI:LEN_ASCI)<>'"' THEN !:
LINPUT #CSV_HANDLE: BUFF$ EOF 70080 !:
LET ASCI$=ASCI$&"|"&BUFF$ !:
GOTO 70050
 
 
ASCI$ is a line in the CRLF file.
The theory is that the 1st character MUST be a “ for each record.
In addition, the theory is that the LAST character of a RECORD must also be a “
We then “Glue” these multiple lines with a | to replace the CRLF
 
This theory works very nicely.   Remember ASCI$ and BUFF$ need to be dimensioned to the largest possible values.
 
Luis I. Gomez
GomezL@CollectionSoftware.com (GomezL@CollectionSoftware.com)
1-800-435-7257
Commercial Legal Software, Inc.
http://www.CollectionSoftware.com
 

From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf Of Gabriel Bakker
Sent: Wednesday, May 13, 2009 10:58 AM

To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR





 
Unfortunatly, the "C"s aren't really in my data file, I just threw together some sample data to demonstrate the problem. But you give me an idea. I wonder if I COULD get the CSV export to export a couple of blank fields or something first, so that any time I see a "<CR>,," I use it as a delimiter, and any time there is a <CR> not immediatly followed by two commas, I SREP it out and replace it with a different delimiter that won't screw up the length of the BR line.

 

Reading it in BR 4.2 is nice, it allows me to read the entire file at once, without needing to do it in chunks. They also have a number of other functions that make working with CSV files easier.

 

Thanks everyone for all your help. I'll let you know when I have it working..

 

Gabriel

On Wed, May 13, 2009 at 8:53 AM, Susan Smith <susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:
Hi Gabriel,

Can you get rid of those embedded CRs by reading in the entire file in ONE big chunk in BR 4.2, create a cleaned up file without the CRs to use with the CSV parsing routines?

OPEN #1: "name=FILENAME,eol=none",DISPLAY,INPUT
LET filelength=LREC(1)

Then in BR 4.2, dim a variable the size of filelength, open the file and read it in one read stmt into your big variable, loop through the variable searching for instances of '"C"' with a POS statement to find the start of each line, break off those lines and "print" to a new display file, SREPing out the CRs first. THEN you can LINPUT it back in. Would that work?

-- Susan

Gabriel Bakker wrote:
Thank you David, Luis, and George!

 

I'm particularly having a problem with embedded carriage returns in the data. These screw up the BR LINPUT command and the BR INPUT command.

 

That is, the CSV file will have something like:

 

"C",13,"Samual L Jackson","1123 S Davis St","Arlington","TX"

"C",14,"Peter Fonda","ATTN: Jane

1125 S Davis St","Arlington","TX"

"C",15,"Dennis Hopper","1127 S Davis St","Arlington","TX"

"C",16,"George Clooney","P.O. Box 127

Somewhere Ave","Arlington","TX"

"C",17,"Billy Joel","1115 Benge","Arlington","TX"

 

Notice the embedded carriage return in Peter Fonda's street address, and the one in George Clooney's Street Address?

 

I'm doing a CSV export on a Microsoft Address Book, to import the contacts in the address book into their BR software. But they have embedded carriage returns in their street addresses, which are confusing the hell out of BR. Windows thinks its fine to put a carriage return in a CSV file, because if its inside quotes, anything goes, right? But BR respects the carriage return above and beyond any quotes, commas, or other delimiters.

 

I'm going to try the functions you sent me and see how far we get.

 

Gabriel

On Wed, May 13, 2009 at 8:20 AM, Max Rubow <maxrubow@gmail.com (maxrubow@gmail.com)> wrote:
Do you still have access to LORICA functions?  TONS of encapsulated
behaviors there from years of work.

On Tue, May 12, 2009 at 12:48 PM, Gabriel Bakker
<gabriel.bakker@gmail.com (gabriel.bakker@gmail.com)> wrote:
I think CSV files is an excellent use for these functions.

I am constantly having problems with encapsulation characters in BR's
reading of CSV files. Encapsulation characters have become a standard but BR
doesn't handle them properly. I really wish it did. If they were able to add
it to the STR2MAT functions then that would solve my problems.


While were at it, does anyone on the forum have functions for parsing and
reading CSV files that they would like to share? We all know how fun it is
to reinvent the wheel, but I'd rather skip that process if I can on this
one.


Gabriel

On Sun, May 10, 2009 at 7:21 PM, George Tisdale <GTISDALE@tisdalecpa.com (GTISDALE@tisdalecpa.com)>
wrote:
I expect that you will find more uses for this function when we start
parsing XML files.  For the time being don’t worry about it unless you have
a real need.



George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA  01742
(978) 369-5585

IRS Circular 230 Notice: "To ensure compliance with requirements imposed
by the IRS, we inform you that any U.S. tax advice contained in this
communication (including any attachments) is not intended or written to be
used, and cannot be used, for the purpose of (i) avoiding penalties under
the Internal Revenue Code or (ii) promoting, marketing or recommending to
another party any transaction or matter addressed herein."

This electronic message transmission contains information which is
intended only for the use of the individual or entity to which it is
addressed and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. If the reader of this message
is not the intended recipient, you are hereby notified that any
dissemination or distribution of this communication to other than the
intended recipient is strictly prohibited. If you have received this
communication in error, please notify us immediately by calling (978)
369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.



From: br_forum-bounces@ads.net (br_forum-bounces@ads.net) [mailto:br_forum-bounces@ads.net (br_forum-bounces@ads.net)] On Behalf
Of John Bowman
Sent: Sunday, May 10, 2009 1:43 PM
To: Business Rules Forum
Subject: Re: [BR_forum] BR 4.2: STR2MAT and MAT2STR



it's not too late at all!  use source safe or some other Version Control
System and go head long into it... if you *can't* make it work for some
reason, just roll back to where you need to.  check in and check out often.

(you typed it first, you use it first, you definately got me beat on this
one, but yea i did get 4.1 before you)

:)
-john

On Sun, May 10, 2009 at 1:28 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Oh, don't kid yourself. I'm not USING the new features yet...or even 4.2.
I'm just playing a bit to try to determine what my client's next upgrade
path should be. I'm not even using GUI or NWP really. We went straight from
4.03 to 4.17 GUI using a non-proportional font, but no GUI controls. I'm not
taking advantage of ANY new features yet - or even many old ones. But that
is changing now that my client is finally interested.  They may not be
willing to finance it (this is a custom system), but I'm considering just
doing it myself (mostly) so I don't get stuck in "yesterday" forever. It's
never too late, right?

-- Susan

John Bowman wrote:

i'm kinda envious that you're using the newest features that I'm not using
yet...   hmmm, where's my remote desktop connection to the office...

:)
-john

On Sun, May 10, 2009 at 1:19 PM, John Bowman <gothnerd@gmail.com (gothnerd@gmail.com)> wrote:

don't fear using the wiki.  if you add wrong information it will be as
though it corrects itself (because i or someone else will be helping).  just
do your best.  don't be afraid to try.



On Sun, May 10, 2009 at 1:11 PM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

John,

I'm not sure that MAT2STR and STR2MAT were designed to do what I'm trying
to do. I really don't know anything about them - yet. So I'd hate to update
the wiki with bad information. I'm hoping that Gordon or perhaps the person
who asked for that feature (or someone else who is using it) can shed some
more light on it's purpose.

-- Susan


John Bowman wrote:

if you figrue it out please update it on the wiki - we need a page titled
Mat2Str and another titled Str2Mat.  usually what i do in these cases is
make the pages, cut and paste the text from the release notes  [[4.20]] and
then in the release notes just leave something simple like "[[Str2Mat]] and
[[Mat2Str]] introduced."

-john


On Sun, May 10, 2009 at 11:12 AM, Susan Smith
<susan@creativelyspeaking.net (susan@creativelyspeaking.net)> wrote:

Follow-up:
I DID get MAT2STR to create a line I could use for creating CSV files be
specifying a comma as a delimiter (didn't know I could) do that:
MAT2STR$(MAT a$,LONGLINE$,",")

But I can't do the reverse and parse a comma-delimited string into an
array with STR2MAT. I tried to use a comma as the delimiter, and although it
doesn't error, the array is not loaded.

ENCAPSULATION CHARACTER OPTION for STR2MAT and MAT2STR
Assuming that I get this working, it would be great to have an option to
use encapsulation characters such as quotes (") around each element. Then
you could effectively take an address or name that has a comma embedded in
it  such as Adam Smith, Jr. or Sierra Madre, CA and create "Adam Smith, Jr."
or "Sierra Madre, CA" when going back and forth. STR2MAT could have the
option to STRIP an encapsulation character and MAT2STR could ADD the
encapsulation character.

The result would be:
MAT2STR$(MAT ARRAYNAME$,STRINGNAME$,DELIMITER$,ENCAPSULATION_CHAR$)

In the meantime, I'll continue to use my user-defined functions for this
(the ones in my disorganized libraries).

-- Susan



Susan Smith wrote:

Hi all,

Can someone tell me what you'd use STR2MAT and MAT2STR for in BR 4.2?  I
looked at George's sample program for STR2MAT on the conference flash drive,
and although I can follow it, I guess I'm still not sure what this
function's purpose is.

I assumed that it could be used to create text lines for CSV files or to
parse CSV lines into an array, but I don't seem to be able to get that
working. Perhaps that's not what it's designed for. It seems like a valuable
feature if only I could figure out why you'd use it.

-- Susan



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net



 
 _______________________________________________BR_forum mailing listBR_forum@ads.net (BR_forum@ads.net)http://ads.net/mailman/listinfo/br_forum_ads.net 
 


_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net

 




_______________________________________________
BR_forum mailing list
BR_forum@ads.net (BR_forum@ads.net)
http://ads.net/mailman/listinfo/br_forum_ads.net
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

str2mat on http://brwiki.ads.net/index.php?title=Str2mat is documented as having a series of default strings to replace... \n\r \r\n etc... which \n or \r is meant to represent carriage return and which is designated to represent line feed... also will the replace a literal "\n" and/or "\r" and combinations or just actual carriadge returns and line feeds?

-John
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

the \n and \r s in the documentation we're represenations for line feeds and carriage returns. I enhanced the docuemtation to more clearly document this.
Post Reply