Hi, In my previous post to this one I was having a problem running an export operation from within the script so I decided to place 2 buttons on our main menu to run the script and the export. The export runs fine but I'm having problems with running the script. I found out through other posts within the forum I needed to open a new session for the script to function. I called that out in the code. However, my script is acting as though the query that's being performed is actually running in the previous open session (from where the main menu is located with the buttons). The number of records found is appearing in the lower right hand corner but when the report is run, it is actually showing results for all records within the table (ameregl3). I'm missing something on how to call out the table within the new open session. Please see my code below. Any help is appreciated.
dim Tbl as P
dim Tbl1 as P
dim user as D
dim user1 as C
dim user2 as D
tbl1 = set.open_session("ameagle")
tbl = table.current()
dstr = ui_get_date("BTC Date","Please Enter the BTC Date")
if dstr=""then
end
end if
user=ctod(dstr)
tstr1 = ui_get_text("Invoice Number","Please Enter An Invoice Number")
if tstr1=""then
end
end if
user1=(tstr1)
dstr2 = ui_get_date("Invoice Date","Please Enter An Invoice Date")
if dstr2=""then
end
end if
user2=ctod(dstr2)
query.description = ""
query.order = "CDATE(BTC)"
query.filter = "AMEREGL3->BTC=(user).AND.AMEREGL3->ATTORNEY=\"sbda-l\""
query.options = "I"
tbl.query_create()
address_of_Service.value=CASE(ameregl3->checkbox_2=(.T.),ameregl3->address,ameregl3->checkbox_2=(.F.),ameregl3->ameregl3->poe_address)
fee.value=CASE(ameregl3->wait_time=(.T.),ameregl3->fee+35.00,ameregl3->special_handling=(.T.),ameregl3->fee+20.00)
poe_name.value=CASE(ameregl3->checkbox_3=.T.,ameregl3->poe_name,ameregl3->checkbox_3=.F.,"")
tbl.fetch_first()
while .not. tbl.fetch_eof()
tbl.change_begin()
ameregl3->type=CASE(ameregl3->Type_Of_Service="P","POS",ameregl3->Type_Of_Service="S","POS",ameregl3->Type_Of_Service="B","DEC",ameregl3->Type_Of_Service="U","DEC")
ameregl3->records_number=(user1)
ameregl3->invoice_date=(user2)
tbl.change_end()
tbl.fetch_next()
end while
:Report.preview("Daily_Invoices_LL")
END
Thanks for reading my post. I'm quite sure it's a simple callout as a pointer I'm just not sure how to do it.
dim Tbl as P
dim Tbl1 as P
dim user as D
dim user1 as C
dim user2 as D
tbl1 = set.open_session("ameagle")
tbl = table.current()
dstr = ui_get_date("BTC Date","Please Enter the BTC Date")
if dstr=""then
end
end if
user=ctod(dstr)
tstr1 = ui_get_text("Invoice Number","Please Enter An Invoice Number")
if tstr1=""then
end
end if
user1=(tstr1)
dstr2 = ui_get_date("Invoice Date","Please Enter An Invoice Date")
if dstr2=""then
end
end if
user2=ctod(dstr2)
query.description = ""
query.order = "CDATE(BTC)"
query.filter = "AMEREGL3->BTC=(user).AND.AMEREGL3->ATTORNEY=\"sbda-l\""
query.options = "I"
tbl.query_create()
address_of_Service.value=CASE(ameregl3->checkbox_2=(.T.),ameregl3->address,ameregl3->checkbox_2=(.F.),ameregl3->ameregl3->poe_address)
fee.value=CASE(ameregl3->wait_time=(.T.),ameregl3->fee+35.00,ameregl3->special_handling=(.T.),ameregl3->fee+20.00)
poe_name.value=CASE(ameregl3->checkbox_3=.T.,ameregl3->poe_name,ameregl3->checkbox_3=.F.,"")
tbl.fetch_first()
while .not. tbl.fetch_eof()
tbl.change_begin()
ameregl3->type=CASE(ameregl3->Type_Of_Service="P","POS",ameregl3->Type_Of_Service="S","POS",ameregl3->Type_Of_Service="B","DEC",ameregl3->Type_Of_Service="U","DEC")
ameregl3->records_number=(user1)
ameregl3->invoice_date=(user2)
tbl.change_end()
tbl.fetch_next()
end while
:Report.preview("Daily_Invoices_LL")
END
Thanks for reading my post. I'm quite sure it's a simple callout as a pointer I'm just not sure how to do it.
Comment