countnikon
22nd March 2006, 16:35
Hi all,

Hopefully this will be an easy question for you guys. I'm exporting data from an Oracle database to an Excel document that will be uploaded to a web server. The thing is that the particular table does not have a specific field that is required for the document. Instead of making the users input the data and modify the table structure and session, I want to dynamically add it in based on the description. I was wondering if there is a function that is already out there to do this? Thanks all.


|******************************************************************************
|* tdinv9240 0 VRC B40C c4 csi0
|* Export CSV and Upload to Site
|* General_User_Unix
|* 2006-03-21
|******************************************************************************
|* Main table tdinv001 Item Data by Warehouse, Form Type 4
|******************************************************************************

|****************************** declaration section ***************************
declaration:

table ttdinv001 | Item Data by Warehouse
table ttiitm001 | Items
table ttccom010 | Customers
table ttccom013 | Customer Addresses



|****************************** form section **********************************

|****************************** choice section ********************************

|****************************** field section *********************************

|****************************** function section ******************************

functions:

function read.main.table()
{
serverfilename = "/baan/parts/inventbycwar.txt"
select *
from tdinv001
where tdinv001.item > "JAA000"
and tdinv001.item < "JGZ999"
selectdo
output.line( """"&tdinv001.item
&"|"&tdinv001.seab
&"|"&tdinv001.dsca
&"|"&tdinv001.pric
&"|"&tdinv001.stoc
&"|"&getcatagory()
&"""")
endselect
templong = run.prog("/usr/local/bin/baan.parts_upload", hold.datestring,RP_WAIT)

}

function domain tcnama getcatagory()
{
domain tcnama ret.val

return(ret.val)
}

mark_h
22nd March 2006, 17:04
I have never tried calling a subroutine in a subroutine call. The only thing I would do different is call category before the output.line statement. Then just use the table field name for category in the output line. So I am not sure if I understand your question or what you are looking for.

countnikon
22nd March 2006, 17:24
To give a bit of a better description. Lets say there is a description that's value is CROSSHEADXLTCI7.7#162S:M:P. I want to see if it is LIKE CROSSHEAD and make the catagory column to show CROSSHEAD.

mark_h
22nd March 2006, 17:38
How about this example:


wild = ".*"
itemdesc = wild & strip$(toupper$(descrip)) & wild

sql.code = ""
found = true
sql.code = sql.code & "select tipgc001_1.item:grp.item, tipgc001_1.ccot:prj.grp, tiitm001_1.dsca:item.dsca "
sql.code = sql.code & "from tipgc001 tipgc001_1, tiitm001 tiitm001_1 "
sql.code = sql.code & "where tipgc001_1._index1 inrange {" & chr$(34) & prjgrp.from & chr$(34) & "," & chr$(34) & item.from & chr$(34) &"} "
sql.code = sql.code & "and {" & chr$(34) & prjgrp.to & chr$(34) & "," & chr$(34) & item.to & chr$(34) & "} "
sql.code = sql.code & "and tipgc001_1.buyr = " & str$(current.buyer) & " "
sql.code = sql.code & "and tiitm001_1.item = tipgc001_1.item "
sql.code = sql.code & "and tiitm001_1.dsca like " & chr$(34) & strip$(itemdesc) & chr$(34)
sql_id = sql.parse(sql.code)
sql.exec(sql_id)
while found
on case sql.fetch(sql_id)
case eendfile:
found = false
break
case 0:
found = true
tipgc001.item = grp.item
tipgc001.ccot = prj.grp
tiitm001.dsca = item.dsca
rprt_send()
if update.grp.item = tcyesno.yes then
update.group.item()
endif
if update.std.item = tcyesno.yes then
update.standard.item()
endif
break
default:
found = false
endcase
endwhile

}

countnikon
22nd March 2006, 17:45
I'll give it a shot. Thanks a bunch for the help.