New Progress Code Question

Here is a chunk of code I use to parse the MfgComment (which may have
multiple SMTypes in it).

/*SMType*/
strt = INDEX((PartRev.MfgComment),"S/M Type").
DO WHILE (strt>0):

EndLine = INDEX((PartRev.MfgComment),CHR(10),strt).
EndLine2 = INDEX((PartRev.MfgComment),CHR(13),strt).
IF EndLine2 <> 0 AND EndLine2 < EndLine THEN
EndLine = EndLine2.
IF EndLine = 0 THEN DO:
EndLine = LENGTH((PartRev.MfgComment), "CHARACTER").
END.
ELSE DO:
if GetNextLine(EndLine + 1) <> 0 then
NextLineAfterSMType =
SUBSTRING((PartRev.MfgComment),strt,GetNextLine(EndLine + 1) - strt).
END.

SMType = SUBSTRING((PartRev.MfgComment),strt,EndLine -
strt).
Export DELIMITER ","
PartNum
RevisionNum
ApprovedBy
ApprovedDate
SMType
NextLineAfterSMType.

SMType = "".
NextLineAfterSMType = "".
strt = INDEX((PartRev.MfgComment),"S/M Type",EndLine).
END.

Instead of Exporting were I do you could go find the records you need
and gather them to a temp table or such.
4GL beats SQL hands down for pulling adhoc relationships on the fly out
of a database.

Jeff Lewis



-----Original Message-----
From: Lonnie Drew [mailto:lonniedrew@...]
Sent: Tuesday, April 20, 2004 2:53 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: New Progress Code Question


Oops, I forgot to specify the starting point, 1, for getting
partnum...

/* get the partnum */
ThePartnum = substring(LastPartOfMemo,1,EndPoint - 1).



--- In vantage@yahoogroups.com, "Lonnie Drew" <lonniedrew@c...>
wrote:
> This might get you started. If the partnumber is always
preceded
> by "Part:" and followed by ","...
>
> /* trim memo to position past "part:" */
> LastPartOfMemo = substring(memofield,index(memofield,"Part:" +
5)).
>
> /* locate position of "," signaling end of partnum */
> EndPoint = Index(LastPartOfMemo,",").
>
> /* get the partnum */
> ThePartnum = substring(LastPartOfMemo,EndPoint - 1).
>
> ...I'm treating the memo field as any text field, which may
not be
> the case.
>
> Lonnie
>
> --- In vantage@yahoogroups.com, "othyghost" <Eric@o...> wrote:
> > Ok this one has me stumped. I am tring to write progress
code
that
> > will be able to read through a memo field and pick out a
sentence
> > then assign that to a variable to find the corrisponding
record
in
> > another table. For example. The Memotext =
> > "Source-BOM
> > Part:00, Rev:MOM7
> > User: ERIC, Date: 04/14/04, Time: 10:48 AM"
> >
> > Basically what I am trying to do is link the JobOper to a
PartOper
> > record but the part number I need is in this memo field. I
need
to
> > be able to pull out the text after the Part: and assign it
to a
> > variable. I believe their is always a comma after the part
number
> > so that would be easy to stop it at.
> >
> > Thanks
> >
> > Eric




[Non-text portions of this message have been removed]
Ok this one has me stumped. I am tring to write progress code that
will be able to read through a memo field and pick out a sentence
then assign that to a variable to find the corrisponding record in
another table. For example. The Memotext =
"Source-BOM
Part:00, Rev:MOM7
User: ERIC, Date: 04/14/04, Time: 10:48 AM"

Basically what I am trying to do is link the JobOper to a PartOper
record but the part number I need is in this memo field. I need to
be able to pull out the text after the Part: and assign it to a
variable. I believe their is always a comma after the part number
so that would be easy to stop it at.

Thanks

Eric
This might get you started. If the partnumber is always preceded
by "Part:" and followed by ","...

/* trim memo to position past "part:" */
LastPartOfMemo = substring(memofield,index(memofield,"Part:" + 5)).

/* locate position of "," signaling end of partnum */
EndPoint = Index(LastPartOfMemo,",").

/* get the partnum */
ThePartnum = substring(LastPartOfMemo,EndPoint - 1).

...I'm treating the memo field as any text field, which may not be
the case.

Lonnie

--- In vantage@yahoogroups.com, "othyghost" <Eric@o...> wrote:
> Ok this one has me stumped. I am tring to write progress code that
> will be able to read through a memo field and pick out a sentence
> then assign that to a variable to find the corrisponding record in
> another table. For example. The Memotext =
> "Source-BOM
> Part:00, Rev:MOM7
> User: ERIC, Date: 04/14/04, Time: 10:48 AM"
>
> Basically what I am trying to do is link the JobOper to a PartOper
> record but the part number I need is in this memo field. I need to
> be able to pull out the text after the Part: and assign it to a
> variable. I believe their is always a comma after the part number
> so that would be easy to stop it at.
>
> Thanks
>
> Eric
Oops, I forgot to specify the starting point, 1, for getting
partnum...

/* get the partnum */
ThePartnum = substring(LastPartOfMemo,1,EndPoint - 1).



--- In vantage@yahoogroups.com, "Lonnie Drew" <lonniedrew@c...> wrote:
> This might get you started. If the partnumber is always preceded
> by "Part:" and followed by ","...
>
> /* trim memo to position past "part:" */
> LastPartOfMemo = substring(memofield,index(memofield,"Part:" + 5)).
>
> /* locate position of "," signaling end of partnum */
> EndPoint = Index(LastPartOfMemo,",").
>
> /* get the partnum */
> ThePartnum = substring(LastPartOfMemo,EndPoint - 1).
>
> ...I'm treating the memo field as any text field, which may not be
> the case.
>
> Lonnie
>
> --- In vantage@yahoogroups.com, "othyghost" <Eric@o...> wrote:
> > Ok this one has me stumped. I am tring to write progress code
that
> > will be able to read through a memo field and pick out a sentence
> > then assign that to a variable to find the corrisponding record
in
> > another table. For example. The Memotext =
> > "Source-BOM
> > Part:00, Rev:MOM7
> > User: ERIC, Date: 04/14/04, Time: 10:48 AM"
> >
> > Basically what I am trying to do is link the JobOper to a
PartOper
> > record but the part number I need is in this memo field. I need
to
> > be able to pull out the text after the Part: and assign it to a
> > variable. I believe their is always a comma after the part
number
> > so that would be easy to stop it at.
> >
> > Thanks
> >
> > Eric