I have just create a set with :
' Xbasic script for create a set
'
child="z01_vga"
setable="z02_vga"
parent1="ZONA"
parentk1="Idzona"
childk1="IDZONA"
child3="AGENTE"
parentk3="AGENTE"
childk3="IDAGENTE"
child1=child+"_" + str(year(date())-1,4,0)
child2=child+"_" + str(year(date()),4,0)
nameset=filename_decode(setable+".set")
parent = table.open(parent1)
child_tbl = table.open(child1,FILE_RW_EXCLUSIVE,"year1")
table.index_create_begin("MAIN", childk1)
index1=child_tbl.index_create_end()
relation.link_type = LINK_MANY
child_index = child_tbl.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk1
relation.ref_integrity = 0
parent.relation_add(child_tbl)
level2 = table.open(child3)
table.index_create_begin("MAIN", childk3)
index1=level2.index_create_end()
relation.link_type = LINK_FIRST
child_index = level2.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk3
relation.ref_integrity = 0
child_tbl.relation_add(level2)
child_tbl = table.open(child2,FILE_RW_EXCLUSIVE,"year2")
table.index_create_begin("MAIN", childk1)
index1=child_tbl.index_create_end()
relation.link_type = LINK_MANY
child_index = child_tbl.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk1
relation.ref_integrity = 0
parent.relation_add(child_tbl)
level3 = table.open(child3)
table.index_create_begin("MAIN", childk3)
index1=level3.index_create_end()
relation.link_type = LINK_FIRST
child_index = level3.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk3
relation.ref_integrity = 0
child_tbl.relation_add(level3)
parent.set_create(nameset)
level3.close()
level2.close()
child_tbl.close()
parent.close()
file_add_to_db(nameset)
after execution of the script in the control-panel I see the new created set but when I try to open it the Alpha message 'Could not find set '...' appear. The set is on correct location and the button "Design -> Table in set" show the right tables.
Please help me...
P.S. I'am Italiano of Napoli, sorry for my english. There are italian developer in our excellent Alpha 5 ?
' Xbasic script for create a set
'
child="z01_vga"
setable="z02_vga"
parent1="ZONA"
parentk1="Idzona"
childk1="IDZONA"
child3="AGENTE"
parentk3="AGENTE"
childk3="IDAGENTE"
child1=child+"_" + str(year(date())-1,4,0)
child2=child+"_" + str(year(date()),4,0)
nameset=filename_decode(setable+".set")
parent = table.open(parent1)
child_tbl = table.open(child1,FILE_RW_EXCLUSIVE,"year1")
table.index_create_begin("MAIN", childk1)
index1=child_tbl.index_create_end()
relation.link_type = LINK_MANY
child_index = child_tbl.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk1
relation.ref_integrity = 0
parent.relation_add(child_tbl)
level2 = table.open(child3)
table.index_create_begin("MAIN", childk3)
index1=level2.index_create_end()
relation.link_type = LINK_FIRST
child_index = level2.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk3
relation.ref_integrity = 0
child_tbl.relation_add(level2)
child_tbl = table.open(child2,FILE_RW_EXCLUSIVE,"year2")
table.index_create_begin("MAIN", childk1)
index1=child_tbl.index_create_end()
relation.link_type = LINK_MANY
child_index = child_tbl.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk1
relation.ref_integrity = 0
parent.relation_add(child_tbl)
level3 = table.open(child3)
table.index_create_begin("MAIN", childk3)
index1=level3.index_create_end()
relation.link_type = LINK_FIRST
child_index = level3.index_get("MAIN")
relation.index_child = child_index
relation.order_parent = parentk3
relation.ref_integrity = 0
child_tbl.relation_add(level3)
parent.set_create(nameset)
level3.close()
level2.close()
child_tbl.close()
parent.close()
file_add_to_db(nameset)
after execution of the script in the control-panel I see the new created set but when I try to open it the Alpha message 'Could not find set '...' appear. The set is on correct location and the button "Design -> Table in set" show the right tables.
Please help me...
P.S. I'am Italiano of Napoli, sorry for my english. There are italian developer in our excellent Alpha 5 ?
Comment