From: richard.townsendrose on
Hi all

I have a bbrowser with a vriable no of columns.

i have a function which creates the data to be displayed in all but
the first column which is driven from a normal table.

any ideas on how to do this ? see bnelow for my code as at present

richard

here is the column instantiation:
DO WHILE ! SELF:oPF:EoF
cItem:=SELF:oPF:FIELDGET(#ItemNo)
cTip:=SELF:oPF:FIELDGET(#FLOWTITLE)+CRLF+;
IIF(SELF:oPF:FIELDGET(#DOCTYPE)=='R','Contact, Subject:',IIF
(SELF:oPF:FIELDGET(#DOCTYPE)=='C','Gen Doc, Subject:','Inspection,
WP:')) + SELF:oPF:FIELDGET(#TYPEREF)+CRLF+;
IIF(Empty(SELF:oPF:FIELDGET(#KEYWORD)),'','Keyword:
'+SELF:oPF:FIELDGET(#KEYWORD))
oCol:=bDataColumn{SELF:oDCbrGroups,SELF:oAD,{|oSvr, oWin, cItem|
oWin:GetInfo(oSvr:FIELDGET(#ASSETREF), cItem)}, #Expression, SELF,
cItem}
cItem:=cItem + CRLF + AllTrim(SELF:oPF:FIELDGET(#FLOWTITLE))
oCol:HyperLabel:=HyperLabel{#abc, cItem, cTip}
oCol:HeightVariable := BACTIVE
oCol:Width:=80
SELF:oDCbrGroups:AddColumn(oCol)
SELF:oDCbrGroups:OpenColumn(oCol)
SELF:oPF:Skip()
ENDDO

next i have the method GetInfo().
i want to read the cell data from an already instantiated column when
calculating the cell data for a later column

anyway here is the code ...

METHOD GetInfo(cGroup, cItem) CLASS WFReview
LOCAL cAns:='' AS STRING
LOCAL cType AS STRING
LOCAL cTypeRef AS STRING
LOCAL cKeyWord AS STRING
LOCAL cKeyType AS STRING
LOCAL cColType AS STRING
LOCAL cSrc AS STRING
LOCAL cForm AS STRING
LOCAL cTrigCol AS STRING
LOCAL cTrigType AS STRING
LOCAL oCol AS bDataColumn

IF SELF:oPF:Seek(SELF:cJobNo + SELF:cFlowNo + cItem)
cType:=SELF:oPF:FIELDGET(#DOCTYPE)
cTypeRef:=SELF:oPF:FIELDGET(#TYPEREF)
cKeyWord:=AllTrim(SELF:oPF:FIELDGET(#KEYWORD))
cKeyType:=SELF:oPF:FIELDGET(#KEYTYPE)
cSrc:=SELF:oPF:FIELDGET(#IOCODE)
cForm:=SELF:oPF:FIELDGET(#CONTTYPE)
cColType:=SELF:oPF:FIELDGET(#DataShow)

cTrigCol:=SELF:oPF:FIELDGET(#TrigCol)
cTrigType:=SELF:oPF:FIELDGET(#TrigType)

oCol:=NULL_OBJECT


DO CASE
CASE cType == 'R' // contact
// locate contact - jobno+assetref+subjref+nameref+str(descend
(DATED))
IF SELF:oCU:Seek(SELF:cJobNo + cGroup + cTypeRef + cGroup)
IF cColType == 'F'
cAns:=AsString(SELF:oCU:FIELDGET(AsSymbol(cKeyWord)))
ELSEIF ! Empty(cKeyWord)
cAns:=GetKeyData(cKeyWord, SELF:oCU:FIELDGET(#TEXTREF),
cKeyType, FALSE)
IF cKeyType == 'Y' .AND. Instr('Y', Upper(cAns))
cAns:=cAns
ELSEIF cKeyType == 'Y' .AND. ! Instr('Y', Upper(cAns))
cAns:=cAns
ELSE
cAns:=cAns
ENDIF
ELSE
cAns:='Contact found'
ENDIF
ELSE
cAns:='No Contact found'
ENDIF

CASE cType == 'C' // gendoc
// is it triggered
IF ! Empty(cTrigCol)
// cAns:=AllTrim(SELF:oDCbrGroups:GetColumn():TextValue)
ENDIF

// locate document - Jobno+AssetRef+SubjRef+DocSrc+Type
+str(descend(DATERECVD))
IF SELF:oGD:Seek(SELF:cJobNo + cGroup + cTypeRef + cSrc +
cForm) // #### CandK
IF cColType == 'F' .AND. ! Empty(cKeyWord)
cAns:=AsString(SELF:oGD:FIELDGET(AsSymbol(cKeyWord)))
ELSEIF cColType == 'K' .AND. ! Empty(cKeyWord)
cAns:=GetKeyData(cKeyWord, RtfToText(SELF:oGD:FIELDGET
(#MESSTEXT)), cKeyType, FALSE)
IF cKeyType == 'Y' .AND. Instr('Y', Upper(cAns))
cAns:=cAns
ELSEIF cKeyType == 'Y' .AND. ! Instr('Y', Upper(cAns))
cAns:=cAns
ELSE
cAns:=cAns
ENDIF
ELSE
IF SELF:oGD:FIELDGET(#DOCSENT)
cAns:='Document sent'
ELSE
cAns:='Document created'
ENDIF
ENDIF

ELSE
IF cSrc == 'I'
cAns:='No incoming document found'
ELSE
cAns:='No outgoing document found'
ENDIF
ENDIF

CASE cType == 'N' // snag
cAns:='See RGTR !'

ENDCASE

ELSE
cAns:='Lost:'+ AllTrim(cGroup) +':'+cItem
ENDIF

RETURN cAns

From: Martin on
What do you want to achieve?

What will be in the columns you want to work with?

This code is a bit difficult to read in a NG reader.

There are techniques using custom data servers.

Martin


From: Stephen Quinn on
Richard

This bit of code achieves nothing
- cAns never changes no matter what the tests evaluate to.

NOTE:
You have it coded 3 times in your (GetInfo()) case statement
- the result won't change in any of them

> IF cKeyType == 'Y' .AND. Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSEIF cKeyType == 'Y' .AND. ! Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSE
> cAns:=cAns
> ENDIF


CYA
Steve


From: Geoff Schaller on
I have no idea what you mean <g>.
And like Steve, I am doubting some of the logic anyhow.



"richard.townsendrose" <richard.townsendrose(a)googlemail.com> wrote in
message
news:6449544b-5b3e-405b-b602-095e40e4a8e3(a)u20g2000vbq.googlegroups.com:

> Hi all
>
> I have a bbrowser with a vriable no of columns.
>
> i have a function which creates the data to be displayed in all but
> the first column which is driven from a normal table.
>
> any ideas on how to do this ? see bnelow for my code as at present
>
> richard
>
> here is the column instantiation:
> DO WHILE ! SELF:oPF:EoF
> cItem:=SELF:oPF:FIELDGET(#ItemNo)
> cTip:=SELF:oPF:FIELDGET(#FLOWTITLE)+CRLF+;
> IIF(SELF:oPF:FIELDGET(#DOCTYPE)=='R','Contact, Subject:',IIF
> (SELF:oPF:FIELDGET(#DOCTYPE)=='C','Gen Doc, Subject:','Inspection,
> WP:')) + SELF:oPF:FIELDGET(#TYPEREF)+CRLF+;
> IIF(Empty(SELF:oPF:FIELDGET(#KEYWORD)),'','Keyword:
> '+SELF:oPF:FIELDGET(#KEYWORD))
> oCol:=bDataColumn{SELF:oDCbrGroups,SELF:oAD,{|oSvr, oWin, cItem|
> oWin:GetInfo(oSvr:FIELDGET(#ASSETREF), cItem)}, #Expression, SELF,
> cItem}
> cItem:=cItem + CRLF + AllTrim(SELF:oPF:FIELDGET(#FLOWTITLE))
> oCol:HyperLabel:=HyperLabel{#abc, cItem, cTip}
> oCol:HeightVariable := BACTIVE
> oCol:Width:=80
> SELF:oDCbrGroups:AddColumn(oCol)
> SELF:oDCbrGroups:OpenColumn(oCol)
> SELF:oPF:Skip()
> ENDDO
>
> next i have the method GetInfo().
> i want to read the cell data from an already instantiated column when
> calculating the cell data for a later column
>
> anyway here is the code ...
>
> METHOD GetInfo(cGroup, cItem) CLASS WFReview
> LOCAL cAns:='' AS STRING
> LOCAL cType AS STRING
> LOCAL cTypeRef AS STRING
> LOCAL cKeyWord AS STRING
> LOCAL cKeyType AS STRING
> LOCAL cColType AS STRING
> LOCAL cSrc AS STRING
> LOCAL cForm AS STRING
> LOCAL cTrigCol AS STRING
> LOCAL cTrigType AS STRING
> LOCAL oCol AS bDataColumn
>
> IF SELF:oPF:Seek(SELF:cJobNo + SELF:cFlowNo + cItem)
> cType:=SELF:oPF:FIELDGET(#DOCTYPE)
> cTypeRef:=SELF:oPF:FIELDGET(#TYPEREF)
> cKeyWord:=AllTrim(SELF:oPF:FIELDGET(#KEYWORD))
> cKeyType:=SELF:oPF:FIELDGET(#KEYTYPE)
> cSrc:=SELF:oPF:FIELDGET(#IOCODE)
> cForm:=SELF:oPF:FIELDGET(#CONTTYPE)
> cColType:=SELF:oPF:FIELDGET(#DataShow)
>
> cTrigCol:=SELF:oPF:FIELDGET(#TrigCol)
> cTrigType:=SELF:oPF:FIELDGET(#TrigType)
>
> oCol:=NULL_OBJECT
>
>
> DO CASE
> CASE cType == 'R' // contact
> // locate contact - jobno+assetref+subjref+nameref+str(descend
> (DATED))
> IF SELF:oCU:Seek(SELF:cJobNo + cGroup + cTypeRef + cGroup)
> IF cColType == 'F'
> cAns:=AsString(SELF:oCU:FIELDGET(AsSymbol(cKeyWord)))
> ELSEIF ! Empty(cKeyWord)
> cAns:=GetKeyData(cKeyWord, SELF:oCU:FIELDGET(#TEXTREF),
> cKeyType, FALSE)
> IF cKeyType == 'Y' .AND. Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSEIF cKeyType == 'Y' .AND. ! Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSE
> cAns:=cAns
> ENDIF
> ELSE
> cAns:='Contact found'
> ENDIF
> ELSE
> cAns:='No Contact found'
> ENDIF
>
> CASE cType == 'C' // gendoc
> // is it triggered
> IF ! Empty(cTrigCol)
> // cAns:=AllTrim(SELF:oDCbrGroups:GetColumn():TextValue)
> ENDIF
>
> // locate document - Jobno+AssetRef+SubjRef+DocSrc+Type
> +str(descend(DATERECVD))
> IF SELF:oGD:Seek(SELF:cJobNo + cGroup + cTypeRef + cSrc +
> cForm) // #### CandK
> IF cColType == 'F' .AND. ! Empty(cKeyWord)
> cAns:=AsString(SELF:oGD:FIELDGET(AsSymbol(cKeyWord)))
> ELSEIF cColType == 'K' .AND. ! Empty(cKeyWord)
> cAns:=GetKeyData(cKeyWord, RtfToText(SELF:oGD:FIELDGET
> (#MESSTEXT)), cKeyType, FALSE)
> IF cKeyType == 'Y' .AND. Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSEIF cKeyType == 'Y' .AND. ! Instr('Y', Upper(cAns))
> cAns:=cAns
> ELSE
> cAns:=cAns
> ENDIF
> ELSE
> IF SELF:oGD:FIELDGET(#DOCSENT)
> cAns:='Document sent'
> ELSE
> cAns:='Document created'
> ENDIF
> ENDIF
>
> ELSE
> IF cSrc == 'I'
> cAns:='No incoming document found'
> ELSE
> cAns:='No outgoing document found'
> ENDIF
> ENDIF
>
> CASE cType == 'N' // snag
> cAns:='See RGTR !'
>
> ENDCASE
>
> ELSE
> cAns:='Lost:'+ AllTrim(cGroup) +':'+cItem
> ENDIF
>
> RETURN cAns

From: richard.townsendrose on
Hi all

the answer is yes.

the browse in question is analysing a series of "events" set in a
"process flow". subsequent events maybe triggered by an earlier event.
thus one needs when analysing say column 11 to know the result of
column 3 ..., and col 15 may need to know the answer to col 11 etc
etc ...

one CANNOT collect the value "on the fly" using the following code
cAns:=AllTrim(SELF:oDCbrGroups:GetColumn
(SELF:oDCbrGroups:CurrentColumn):TextValue)

if you try it the "kid stack" blows up and end of session - not quite
a reboot, but a close and restart of VO required.

the solution is simple.

as each row is parsed by bbrowser, the columns are parsed one at a
time left to right. [except at the very start, so it is best to use a
bdbserver with just one record allowed, and then refresh with the
whole table]

apart from column 1 - the "key" - all other columns pass the key and
the column no to a method - GetInfo(cKey, cCol).

here is how a col is instantiated:
oCol:=bDataColumn{SELF:oDCbrGroups,SELF:oAD,{|oSvr, oWin, cItem|
oWin:GetInfo(oSvr:FIELDGET(#ASSETREF), cItem)}, #Expression, SELF,
cItem}

cItem describes the column

In turn this method after calcilating the result, stores the data to a
STATIC LOCAL ARRAY of {colno, textvalue}. when the key changes [viz
next row starts] it is cleared.

So when column 11 is parsed [using getinfo()], and needs the answer to
column 3 it is in the array. ditto col 15 can read col 11's result.
etc etc

and it is reasonably fast, bearing in mind that each call to getinfo()
is seeking into a different table and assessing things - like reading
an rtf field and checking for keywords...

on the code quoted before, apologies for the cAns:=cAns - but this is
code in development, and the cases will finally require different text
to be displayed ....

it works .... you can see what i mean at
http://www.tdocplus.co.uk/vo/TDOC_072.JPG
nb - link is case sensitive

so in the example shown, when we dont have a landlord [empty col ref
5], we dont need the letter sent or answered .... cols ref 21 and 22

richard
 |  Next  |  Last
Pages: 1 2 3 4
Prev: Sending eMails again
Next: GPF when creating index