//====================================================================
// Event: wfc_n_cst_dwsrv.of_isunique()
//--------------------------------------------------------------------
// Desc: CHECK IF the passed Array is unique in the datawindow
//--------------------------------------------------------------------
// Args:
// value string as_cols[]
//--------------------------------------------------------------------
// RETURN: boolean
// TRUE
// FALSE
//--------------------------------------------------------------------
// Author: LiXG Date: 2007.07.16
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
Long ll_i,ll_rowcount
Long ll_j,ll_upperbound
String ls_Temp1,ls_Filter
String ls_Temp2,ls_Sort
String ls_Text,ls_Msg
Boolean lb_State
//??Temp Data
ll_rowcount = idw_Requestor.Rowcount()
DataStore lds_Temp
lds_Temp = Create DataStore
lds_Temp.Dataobject = idw_Requestor.Dataobject
lds_Temp.Settransobject(SQLCA)
IF idw_Requestor.Rowscopy(1,ll_rowcount,Primary!,lds_Temp,lds_Temp.Rowcount()+1,Primary!) = -1 THEN RETURN TRUE
//??Build SORT?FILTER
ll_upperbound = Upperbound(as_cols[])
FOR ll_j = 1 To ll_upperbound
//Filter
ls_Temp1 = "("+as_cols[ll_j] + " = " + as_cols[ll_j] + "[-1] )"
IF ll_j = 1 THEN
ls_Filter = ls_Temp1
ELSE
ls_Filter = ls_Filter+" AND "+ls_Temp1
END IF
//Sort
ls_Temp2 = as_cols[ll_j]+" A "
IF ll_j = 1 THEN
ls_Sort = ls_Temp2
ELSE
ls_Sort = ls_Sort + " ,"+ls_Temp2
END IF
//get the col title
ls_Text = idw_Requestor.Describe(as_cols[ll_j]+"_t.Text")
IF ll_j = 1 THEN
ls_Msg = ls_Text
ELSE
ls_Msg = ls_Msg + ","+ls_Text
END IF
NEXT
IF Trim(ls_Filter) <>'' THEN
ls_Filter = '(NOT '+ls_Filter+") or getrow()=1"
END IF
//??Sort and Filter ,if there is still have data after filter,it is not unique
lds_Temp.Setsort(ls_Sort)
lds_Temp.Sort()
lds_Temp.Setfilter(ls_Filter)
lds_Temp.Filter()
IF lds_Temp.Rowcount() < ll_rowcount THEN
// Messagebox("", + '['+ls_Msg+"]There is not unique!",StopSign!)
as_Error = '['+ls_Msg+"]is not unique!"
RETURN FALSE
END IF
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.