I have a window inherited from pfc_w_sheet and it contains treeview inherited from u_tv. Below is the script inside the window's open event. At first, it only have 1 argument and the treeview successfully populated and displayed the items. But when the datawindow: d_app_usermenu1 has been modified, inner join and retrieval argument user_id has been added. And la_arg[2] has been added as well in windows open event, the treeview failed to populate the items in the run-time. Found out that the return value in tv_main.of_SetDatasource is -2 which means the DataWindow object did not have any key columns assigned, this is according to the remarks in pfc_u_tv. and I went to check below line of script that returned the -2 value. of_CreateKey function basically, add a computed column to the datawindow object that will contain all the keys concatenated together. This is necessary to be able to find a unique row, this is according from the remarks in pfc_u_tv.
// Add a computed column to the DataWindow object that will
// contain all the keys concatenated together. This is necessary
// to be able to find a unique row.
If of_CreateKey(inv_ds[ai_Level].ds_obj) = -1 Then
// No key columns were defined
inv_ds[ai_Level].s_DataWindow = ""
Destroy inv_ds[ai_Level].ds_obj
Return -2
End if
Any idea on how to deal with this or some work-around? The objective is to retrieve the items or menu that was assigned in the specific user id that's why i need to have an inner join in the SQL query of datawindow.
//Window's Open Event
Any la_arg[]
tv_main.of_SetDatasource(1, "d_app_usermenu1", SQLCA, "menu_name", "", FALSE, 1, 1)
tv_main.of_SetDatasource(2, "d_app_usermenu2", SQLCA, "menu_name", ":parent.1.parent_name", FALSE, 2, 2)
is_userid = Upper(Trim(gnv_App.of_getUserID( )))
la_arg[1] = '0'
la_arg[2] = is_userid
tv_main.of_InitialRetrieve(la_arg)