How to display a record in a browser?

Hi peggers,

I want to show some records from a temp table with a browser.
I get the message "cannot display since no row is selected".
Anyone can help me?? please!!:blue: :confused:
 

MHotovec

Member
Here's what I do, that works quite nicely:
First I define and open the query thusly:

def query q-buy for t-worki.
def browse b-buy query q-buy
disp
t-worki.select no-label format 'x'
t-worki.warr label 'Type' format 'x(4)'
t-worki.genname label 'Mfg' format 'x(4)'
t-worki.ordernum label 'WO Number' format 'x(10)'
t-worki.partno label 'Part Number' format 'x(15)'
t-worki.buyer label 'Buyer' format 'x(8)'
t-worki.stat label 'Stat' format 'x(4)'
t-worki.reqdate label 'ReqDate' format '99/99/99'
t-worki.reqtime label 'Time' format '99999'
t-worki.branch label 'Br' format 'xx'
t-worki.priority label 'P' format 'Y/N'
with 15 down
title ' Press F10 for help '.

form b-buy
with frame f-buy
centered
no-box
width 79.

open query q-buy
for each t-worki no-lock
by t-worki.priority descending
by t-worki.reqdate
by t-worki.reqtime.

enable b-buy with frame f-buy.

Then, because the user is modifying information, and I've got an 'oops' key for them to bail out without saving changes, I assign the temp-table info to variables. All of this starts when the user press the enter key.

on return of b-buy do:

find first workh-file where workh-file.ordernum = t-worki.ordernum no-lock no-error.

find first cust-file where cust-file.code = workh-file.code no-lock no-error.

assign
v-custname = if avail cust-file
then cust-file.name
else 'N/A'
v-ordernum = t-worki.ordernum
v-linenum = t-worki.linenum
v-partno = t-worki.partno
v-descr = t-worki.descr
v-genname = t-worki.genname
v-qty = t-worki.qty
v-branch = t-worki.branch
v-serialnum = t-worki.serialnum
v-modelnum = workh-file.modelnum
v-tech = workh-file.pcsr
v-techid = t-worki.techid
v-onsite = t-worki.onsite
v-remarks = t-worki.remarks
v-bremarks = t-worki.bremarks
v-venref = t-worki.venref
v-eta = t-worki.eta
v-reppart = t-worki.reppart
v-buyer = t-worki.buyer
v-stat = t-worki.stat
v-labor = t-worki.labor
v-entby = t-worki.reqby
v-ordconf = t-worki.ordconf
v-claim = t-worki.claim
v-rma = t-worki.rma
v-woconf = no
v-poconf = no
v-potype = ''
v-shipto = t-worki.shipto
v-priority = t-worki.priority.

I then display the variables to a pre-defined frame and enable the fields that the user can modify.

disp
v-ordernum
v-partno
v-custname
v-descr
v-genname
v-qty
v-branch
v-serialnum
v-tech
v-techid
v-onsite
v-entby
v-remarks
v-bremarks
v-venref
v-eta
v-vcode
v-name
v-reppart
v-buyer
v-stat
v-woconf
v-poconf
v-ordconf
v-claim
v-rma
v-shipto
v-priority
with frame f-info.

enable
v-venref
v-ordconf
v-cost
v-eta
v-potype
v-reppart
v-buyer
v-stat
v-woconf
v-poconf
v-bremarks
v-claim
v-rma
v-labor
with frame f-info.

Perhaps that's more information that you were looking for, and you'd likely be able to eliminate a couple of these steps based on what you're trying to accomplish. Naturally there are just about as many ways to handle this are there are programmers to write it. But this one works for me.

Mark
 
Top