%mandatory --> Selection , DataSourceId ;
%optional  --> dataSourceName;

function createDVPSelectionGroup(Selection, DataSourceId , SelectionGroupName)

if nargin < 2
    error('not enough parameters');
end

if isempty(Selection)
    error('Selection cannot be empty');
end

if isempty(DataSourceId)
    error('DataSourceId cannot be empty');
end

if ~exist('SelectionGroupName','var') || isempty(SelectionGroupName) || isnumeric(SelectionGroupName)
     ctr = getappdata(0,'counter');
    SG_Name = strcat('Group',int2str(++ctr));
    
else 
    SG_Name = SelectionGroupName;
end


data = struct('requestType', 'create', 'operation', 'selectionGroup',...
    'config', struct('id', SG_Name, 'selection',Selection,...
    'dataSourceID', DataSourceId));

sendDataToDVP(data);

end