vincent
10th June 2003, 16:20
Hello All,

I have a "lis" file which has a list of part nos.

i want to write a SELECT query which will be based on the partno fetched from the "lis" file.

The foll is the code i have written but it fails.


declaration:
table ttiitm001
long file_point
extern domain tcitem item.f

form.1:
init.form:
file_point = seq.open("/tmp/part.lis","r")

function read.main.table()
{
while not seq.gets(item.f,1024,file_point)
| message("%s",item.f)
get_data()
endwhile
}

function get_data()
{
select tiitm001.* from tiitm001
where tiitm001.item = :item.f
selectdo
rprt_send()
endselect
}

The WHILE loop prints the contents of the "lis" file properly, but the SELECT give " no data found".

Can any one tell me what is going wrong in the above ?


Any help is most welcome

Thanks in advance.

Dikkie Dik
10th June 2003, 16:33
How is an item shown when read from the database? If it has spaces at the beginning (or end) you have to make sure your function does the same.

e.g.

l_len = len(item.f)
item.f = string.set$(" ", l_len) & item.f

Hope this helps,
Dick

mark_h
10th June 2003, 17:00
Or you could use tt.align.according.domain. Do not forget to add #include <bic_tt> when you compile the script.

Mark