Hi, I'm using Crystal's Processing Extensions to enforce a kind of row level security and have run into a bit of trouble. I've got my extension to do most of what I want it to do. Right now I'm pulling a user_id parameter (user_id is from the database we are reporting on and delivered when a user signs on to Enterprise) and then I'm filling out a parameter, which is used by the report to limit the rows the user sees.
The problem I have run into it to get the processing extension to alter only the parameter that I need. Since this thing is coded in wonderful and easy to use C++, I cannot seem to get it to do a proper string comparison to alter only the prompt that I want updated.
Here is an example of the code I'm using:
As you may be able to see, I'm using their helper function "w2ac(name, nameSize, szName);" to convert from a wide character pointer array to a normal character pointer array. Perhaps this is the promblem with my string compare in the if statement? The conversion is messing up the characters?
Any ideas? I do not even know the difference between a Char* and a char*. I know this code is clunky, but it will get better. I'm just trying to get it to do the basics right now.
The problem I have run into it to get the processing extension to alter only the parameter that I need. Since this thing is coded in wonderful and easy to use C++, I cannot seem to get it to do a proper string comparison to alter only the prompt that I want updated.
Here is an example of the code I'm using:
Code:
unsigned short nameSize=2;
Char* name = new Char[nameSize];
ret = pPromptSetInterface->GetName(pPromptSetInterface->hIPromptSet,i,&nameSize, name);
..... do a bunch of stuff after getting the prompt name....
int vSize = 5;
Char* v = new Char[vSize];
char * szName = new char[nameSize];
w2ac(name, nameSize, szName);
int compSize = 7;
char* comp = new char[compSize];
comp[0] = 'a';
comp[1] = 'd';
comp[2] = 'm';
comp[3] = 'i';
comp[4] = 'n';
comp[5] = '\0';
if(strcmp(szName, comp)) {
v[0] = '1';
v[1] = '\0';
}
}
else {
v[0] = '2';
v[1] = '\0';
}
//update prompt
if(! RET_OK(pPromptSetInterface->SetPromptValue(pPromptSetInterface->hIPromptSet, i,j, ptype, v, v) ))
{
return false;
}
else
std::cout<<"changed values!\n";
// cleanup
delete comp;
delete compSize;
delete v;
As you may be able to see, I'm using their helper function "w2ac(name, nameSize, szName);" to convert from a wide character pointer array to a normal character pointer array. Perhaps this is the promblem with my string compare in the if statement? The conversion is messing up the characters?
Any ideas? I do not even know the difference between a Char* and a char*. I know this code is clunky, but it will get better. I'm just trying to get it to do the basics right now.