Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Select Check Checkbox REPORTVIEW Only List Detect Get Duplicates
;============================================================ ; ; How to Select Checkboxes of all duplicate values in the first row. ; ;============================================================ #DefineSubRoutine MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,MyDialog_ChangeInfo) MSG_INIT=0 ; The one-time initialization MSG_BUTTONPUSHED=2 ; Pushbutton or Picturebutton MSG_RVITEMSELROW=18 ; Reportview item select row MSG_RVCHECKEDITEM=20 ; Reportview checked/unchecked Item DC_CHECKBOX=1 DC_TITLE = 4 DC_RVMATCHCOL=24 DC_RVCHECKEDROWS=26 ;Return code constants RET_DO_CANCEL=0 ; Cancels dialog RET_DO_DEFAULT= -1 ; Continue with default processing for control RET_DO_NOT_EXIT= -2 ; Do not exit the dialog ON_EQUAL = @TRUE ; Initialize variable ON_EQUAL Switch MyDialog_Message ; Switch based on Dialog Message type Case MSG_INIT ; Standard Initialization message DialogProcOptions(MyDialog_Handle,MSG_BUTTONPUSHED,@TRUE) bCheckState = @FALSE ; Starting state is unchecked. Return(RET_DO_DEFAULT) Case MSG_BUTTONPUSHED If MyDialog_Name == "PushButton_SelectDups" lFoundDups = '' ; List of first column items with duplicats nRowMax = ArrInfo(arrArray,1)-1 ; Max index of items array. ; Toggle the state. bCheckState = !bCheckState ; Check or unCheck each row as necessary. For nRow = 0 To nRowMax strItem = arrArray[nRow,0] ; Skip already processed items. If ItemLocate( strItem, lFoundDups, @TAB) Then Continue ; Check for duplicate items nDupCount = ArrInfo(DialogControlGet( MyDialog_Handle, "ReportView_1", 24, strItem),1) If nDupCount > 1 ; Detected an item with duplicates. ; Add to detected dups list lFoundDups = ItemInsert( strItem, -1, lFoundDups, @TAB ) ; Check all intances of this item. lDups = '' For nDup = 1 To nDupCount lDups = ItemInsert( strItem, -1, lDups, @TAB ) If bCheckState != DialogControlGet( MyDialog_Handle, "ReportView_1", DC_CHECKBOX, lDups) DialogControlSet( MyDialog_Handle, "ReportView_1", DC_CHECKBOX,lDups ) EndIf Next ElseIf DialogControlGet( MyDialog_Handle, "ReportView_1", DC_CHECKBOX, strItem) ; Keep non duplicated items unchecked DialogControlSet( MyDialog_Handle, "ReportView_1", DC_CHECKBOX, strItem) EndIf Next ; Toggle the button state. If bCheckState DialogControlSet( MyDialog_Handle, "PushButton_SelectDups", DC_TITLE, 'UnSelect Dups' ) Else DialogControlSet( MyDialog_Handle, "PushButton_SelectDups", DC_TITLE, 'Select Dups' ) EndIf Return(RET_DO_NOT_EXIT) ElseIf MyDialog_Name == "PushButton_Cancel" ; Cancel Return(RET_DO_CANCEL) ElseIf MyDialog_Name == "PushButton_OK" ; OK Return(RET_DO_DEFAULT) EndIf ; MyDialog_Name Return(RET_DO_DEFAULT) EndSwitch ; MyDialog_Message Return(RET_DO_DEFAULT) #EndSubRoutine ; End of Dialog Callback MyDialogCallbackProc ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ filename = 'C:\TEMP\Data\CSV\uselessinfo.csv' ; DirScript(): C:\TEMP\Data\CSV\ arrArray = ArrayFileGetCSV(filename, 0) MyDialogFormat=`WWWDLGED,6.2` MyDialogCaption=`ReportView Check Duplicates` MyDialogX=138 MyDialogY=141 MyDialogWidth=566 MyDialogHeight=243 MyDialogNumControls=004 MyDialogProcedure=`MyDialogCallbackProc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`165,223,036,012,PUSHBUTTON,"PushButton_SelectDups",DEFAULT,"Select Dups",2,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`265,223,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`365,223,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`011,011,450,200,REPORTVIEW,"ReportView_1",arrArray,DEFAULT,DEFAULT,30,203423744,DEFAULT,DEFAULT,"192|192|192"` ButtonPushed=Dialog("MyDialog") Exit
Article ID: W17764
Filename: Select Checkboxes of All Duplicates.txt
File Created: 2013:08:16:11:47:06
Last Updated: 2013:08:16:11:47:06