From: Kevin on
Hi,

Can someone test the code below and tell me what I am doing wrong?

The code to create the bArrayServer and order (_SetupMailDB() ) does not
generate any error.

When an attempt to add the second record is made the Append fails but I
cannot figure out why. As far as I know I have not requested a unique
order. If I leave out the order the records are added without problem.
Trying to create the order after adding the records produces only one
record.

odbmail:errinfo:description is just a null_string.

VO2837
bBrowser 3

Thanks in advance.

Kevin


Function SetupMailDB()
//
// Setup the mail database
//
local oDBMail as bArrayServer
local aStruc as array
local dDate as date
local cTime as string
local cSubject as string
local iCount as int

// Mail DB structure
aStruc := {;
{ "MailDate", "D", 8, 0}, ;
{ "MailTime", "C", 8, 0}, ;
{ "Attachments", "C", 1, 0}, ;
{ "Priority", "N", 2, 0}, ;
{ "Sender", "C", 40, 0}, ;
{ "Receipient", "C", 40, 0}, ;
{ "Subject", "C", 150, 0} ;
}

oDBMail := bArrayServer{ aStruc, {} }
oDBMail:CreateOrder( "MailDate" )

dDate := Today()
cTime := Time()
cSubject := "This is a test message"

oDBMail:SuspendNotification()

for iCount := 1 upto 2
if oDBMail:RecCount = 1
dDate -= 1
cSubject := "This is the " + NTrim(oDBMail:RecCount +1) + " message."
endif

if oDBMail:Append()
oDBMail:FIELDPUT( #MailDate, dDate )
oDBMail:FIELDPUT( #MailTime, cTime )
oDBMail:FIELDPUT( #Attachments, "Y" )
oDBMail:FIELDPUT( #Priority, 3 )
oDBMail:FIELDPUT( #Sender, "from(a)isp.net" )
oDBMail:FIELDPUT( #Receipient, "you(a)anotherisp.ie" )
oDBMail:FIELDPUT( #Subject, cSubject )
oDBMail:Commit()

endif

next

oDBMail:ResetNotification()

oDBMail:GoTop()

return nil

From: Camille Kater on
Kevin,

Try this:

CreateOrder("dtos(Server:MailDate)")

or

CreateOrder({|Server|Dtos(Server:MailDate)})


Camille

Kevin wrote:
> Hi,
>
> Can someone test the code below and tell me what I am doing wrong?
>
> The code to create the bArrayServer and order (_SetupMailDB() ) does not
> generate any error.
>
> When an attempt to add the second record is made the Append fails but I
> cannot figure out why. As far as I know I have not requested a unique
> order. If I leave out the order the records are added without problem.
> Trying to create the order after adding the records produces only one
> record.
>
> odbmail:errinfo:description is just a null_string.
>
> VO2837
> bBrowser 3
>
> Thanks in advance.
>
> Kevin
>
>
> Function SetupMailDB()
> //
> // Setup the mail database
> //
> local oDBMail as bArrayServer
> local aStruc as array
> local dDate as date
> local cTime as string
> local cSubject as string
> local iCount as int
>
> // Mail DB structure
> aStruc := {;
> { "MailDate", "D", 8, 0}, ;
> { "MailTime", "C", 8, 0}, ;
> { "Attachments", "C", 1, 0}, ;
> { "Priority", "N", 2, 0}, ;
> { "Sender", "C", 40, 0}, ;
> { "Receipient", "C", 40, 0}, ;
> { "Subject", "C", 150, 0} ;
> }
>
> oDBMail := bArrayServer{ aStruc, {} }
> oDBMail:CreateOrder( "MailDate" )
>
> dDate := Today()
> cTime := Time()
> cSubject := "This is a test message"
>
> oDBMail:SuspendNotification()
>
> for iCount := 1 upto 2
> if oDBMail:RecCount = 1
> dDate -= 1
> cSubject := "This is the " + NTrim(oDBMail:RecCount +1) + "
> message."
> endif
>
> if oDBMail:Append()
> oDBMail:FIELDPUT( #MailDate, dDate )
> oDBMail:FIELDPUT( #MailTime, cTime )
> oDBMail:FIELDPUT( #Attachments, "Y" )
> oDBMail:FIELDPUT( #Priority, 3 )
> oDBMail:FIELDPUT( #Sender, "from(a)isp.net" )
> oDBMail:FIELDPUT( #Receipient, "you(a)anotherisp.ie" )
> oDBMail:FIELDPUT( #Subject, cSubject )
> oDBMail:Commit()
>
> endif
>
> next
>
> oDBMail:ResetNotification()
>
> oDBMail:GoTop()
>
> return nil
>
From: Kevin on
Camille,

Thanks for that. Including the 'Server:' was all that was needed.

Kevin

"Camille Kater" <katercamXXX(a)pt.lu> wrote in message
news:1273253838_5(a)vo.lu:

> Kevin,
>
> Try this:
>
> CreateOrder("dtos(Server:MailDate)")
>
> or
>
> CreateOrder({|Server|Dtos(Server:MailDate)})
>
>
> Camille
>
> Kevin wrote:
> > Hi,
> >
> > Can someone test the code below and tell me what I am doing wrong?
> >
> > The code to create the bArrayServer and order (_SetupMailDB() ) does not
> > generate any error.
> >
> > When an attempt to add the second record is made the Append fails but I
> > cannot figure out why. As far as I know I have not requested a unique
> > order. If I leave out the order the records are added without problem.
> > Trying to create the order after adding the records produces only one
> > record.
> >
> > odbmail:errinfo:description is just a null_string.
> >
> > VO2837
> > bBrowser 3
> >
> > Thanks in advance.
> >
> > Kevin
> >
> >
> > Function SetupMailDB()
> > //
> > // Setup the mail database
> > //
> > local oDBMail as bArrayServer
> > local aStruc as array
> > local dDate as date
> > local cTime as string
> > local cSubject as string
> > local iCount as int
> >
> > // Mail DB structure
> > aStruc := {;
> > { "MailDate", "D", 8, 0}, ;
> > { "MailTime", "C", 8, 0}, ;
> > { "Attachments", "C", 1, 0}, ;
> > { "Priority", "N", 2, 0}, ;
> > { "Sender", "C", 40, 0}, ;
> > { "Receipient", "C", 40, 0}, ;
> > { "Subject", "C", 150, 0} ;
> > }
> >
> > oDBMail := bArrayServer{ aStruc, {} }
> > oDBMail:CreateOrder( "MailDate" )
> >
> > dDate := Today()
> > cTime := Time()
> > cSubject := "This is a test message"
> >
> > oDBMail:SuspendNotification()
> >
> > for iCount := 1 upto 2
> > if oDBMail:RecCount = 1
> > dDate -= 1
> > cSubject := "This is the " + NTrim(oDBMail:RecCount +1) + "
> > message."
> > endif
> >
> > if oDBMail:Append()
> > oDBMail:FIELDPUT( #MailDate, dDate )
> > oDBMail:FIELDPUT( #MailTime, cTime )
> > oDBMail:FIELDPUT( #Attachments, "Y" )
> > oDBMail:FIELDPUT( #Priority, 3 )
> > oDBMail:FIELDPUT( #Sender, "from(a)isp.net" )
> > oDBMail:FIELDPUT( #Receipient, "you(a)anotherisp.ie" )
> > oDBMail:FIELDPUT( #Subject, cSubject )
> > oDBMail:Commit()
> >
> > endif
> >
> > next
> >
> > oDBMail:ResetNotification()
> >
> > oDBMail:GoTop()
> >
> > return nil
> >

From: richard.townsendrose on
Kevin

Its also a good idea to then do this: barrayserver:setorder(1)

the manual describes this as:

Purpose
Activate an order from the list of the open orders.

i have had very occasional problems when NOT doing this

Richard
 | 
Pages: 1
Prev: Radiobutton in a group
Next: lterative to VO