Hi. Having a problem writing from a field in a child table to a corresponding field in a parent table. The parent table is "ameregl3" and the child table is "auto_serverlist". The tables are linked in the set by the "server" field in the parent and the "name" field in the child table. There are many child tables to this particular set but for the purposes of my script I'm only utilizing these two. My script is as follows:
dim tbl as P
dim tbl2 as P
tbl = table.open("ameregl3")
dstr = ui_get_date("Beginning Date?","How Far Back Do You Wish To Go")
if dstr=""then
end
end if
begindate=ctod(dstr)
dstr1 = ui_get_date("Drop Dead Date","Please Enter Drop Dead Date")
if dstr=""then
end
end if
enddate=ctod(dstr1)
query.description = ""
query.order = ""
query.filter = "BETWEEN(AMEREGL3->DROP_DEAD,{"+dtoc(begindate)+"},{"+dtoc(enddate)+"}).AND. ISBLANK(\"AMEREGL3->DATE_COMP\")"
query.options = "I"
tbl.query_create()
tbl2 = table.open("auto_serverlist")
tbl.fetch_first()
while .not. tbl.fetch_eof()
tbl.change_begin()
ameregl3->server_email = auto_serverlist->email
tbl.change_end()
tbl.fetch_next()
end while
END
The script is working however it is writing in the "server_email" field in the parent, only the first record (by record number) from the child table "auto_serverlist". For each record from the preceding query, it should be linking by the "server" field in the parent and the "name" field in the child and then grabbing the text in the "email" field of the child and writing it to the "server_email" field in the parent. I'm obviously missing something here to tell it that but not sure what. If I comment out the "tbl2 = table.open("auto_serverlist")", then it obviously does not recognize the "auto_serverlist->email" field at all. Any idear are appreciated.
Thanks, Scott
dim tbl as P
dim tbl2 as P
tbl = table.open("ameregl3")
dstr = ui_get_date("Beginning Date?","How Far Back Do You Wish To Go")
if dstr=""then
end
end if
begindate=ctod(dstr)
dstr1 = ui_get_date("Drop Dead Date","Please Enter Drop Dead Date")
if dstr=""then
end
end if
enddate=ctod(dstr1)
query.description = ""
query.order = ""
query.filter = "BETWEEN(AMEREGL3->DROP_DEAD,{"+dtoc(begindate)+"},{"+dtoc(enddate)+"}).AND. ISBLANK(\"AMEREGL3->DATE_COMP\")"
query.options = "I"
tbl.query_create()
tbl2 = table.open("auto_serverlist")
tbl.fetch_first()
while .not. tbl.fetch_eof()
tbl.change_begin()
ameregl3->server_email = auto_serverlist->email
tbl.change_end()
tbl.fetch_next()
end while
END
The script is working however it is writing in the "server_email" field in the parent, only the first record (by record number) from the child table "auto_serverlist". For each record from the preceding query, it should be linking by the "server" field in the parent and the "name" field in the child and then grabbing the text in the "email" field of the child and writing it to the "server_email" field in the parent. I'm obviously missing something here to tell it that but not sure what. If I comment out the "tbl2 = table.open("auto_serverlist")", then it obviously does not recognize the "auto_serverlist->email" field at all. Any idear are appreciated.
Thanks, Scott
Comment