Incorrect syntax when attempting to use two values in order to create a parameter in SSRS - tsql

I'm attempting to create a parameter for when jodrtg.fdescnum <> inmastx.fbin1. I want to be able to use this in a dropdown list selection for my report. I have tried a number of combinations but keep getting syntax errors near the <or =.I'd be appreciative if anyone can point me in the right direction. I've never tried using two fields to create a single parameter before.
This what I've been attempting to get as my final result.
jodrtg.fdescnum <> inmastx.fbin1 = #MoldPress

I learned that you can only use one operator at a time but they can be combined using bool logic.
WHERE (jodrtg.fdescnum <> inmastx.fbin1
OR #ParameterName = 'Unfiltered')

AND (jodrtg.fdescnum <> inmastx.fbin1) OR #MoldPress = 0

Related

Multiple Conditions in one expect

I want to Verify text of AssignedAllUsers List can contains test1 or test2 but it should not contain test3
I am using following but not sure what is the problem with the code I am getting following error : AllAssignee.toContain is not a function
this.IncList = element.all(by.repeater("incident in $ctrl.allIncidents"));
this.AssignedAllUsers = this.IncList.all(by.css('[aria-label="Change assignee to "]'));
AssignedAllUsers.getText().then(function(AllAssignee){
console.log("AllAssignee = "+AllAssignee);
expect((AllAssignee.toContain(Logindata.Username0)) || (AllAssignee.toContain(Logindata.Username1)) && (AllAssignee.not.toContain(Logindata.Username2)));
});
Your error is a syntax issue. toContain belongs outside the value being tested, in other words outside of the first set of parentheses following your expect statement.
You have this:
expect((AllAssignee.toContain(Logindata.Username0)). You also have an extra set of parentheses, though I don't think that really matters.
You need to close the AllAssignee call, it should be: expect(AllAssignee).toContain(Logindata.Username0)
To answer your other question, there's no need to do it in one expect statement really. Since the list should never contain test3, thats your first assertion:
expect(AllAssignee).not.toContain(test3);
As for your other expected values, if you do not know which one will be present, just create an array and put both possible values inside of that. Then you can assert against the array to contain either test1 or test2:
var myArray = ['test1', 'test2'];
expect(myArray).toContain(AllAssignee);
Also see this related question about expecting items items in an array
Able to fix the problem with the code:
expect(AllAssignee).toContain('test1' || 'test2');

Running a query using date from a form MS Access

How do I run a query using a value from a textbox from a form I have? I know that there is another post here at Stackoverflow dealing with this issue but I found it to be insufficient for my needs.
I formated my textbox into Medium Date format with its default value being =Date(). However, when I pick up a date and open my report I get this error:
Runtime error 3071: Expression Too Complex
My where clause is this
WHERE
(
(AllInfo.DateOpened >= CDate([Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value))
)
and I am sure it is this code piece that is throwing the problem since when I take it out of the query the error message simply disappears.
Any ideas?
Try with:
(AllInfo.DateOpened >= DateValue([Forms]![Main Form]![WindowPrintOptions].[Form]!txtDateOpenedFrom))
)
Folks,
I got the problem. It was the "AllInfo" alias. It wasn't applicable at that escope inside the query. By changing the proper things, it was enough to write:
[Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value
Issue solved. Thank you all!

command level parameters in crystal reports

I have a report having 2 parameters carton and location.
Suppose if I didn't gave any value among those then it should give all values.
So created 2 command level parameters.Its showing all values whenever I didnt gave any values in parameters.
But even If I gave some value in either carton or location but still its showing all values.
Please suggest what is the problem
SELECT
crt.carton_no, crtd.part_no, SUM(crtd.quantity) AS quantity,
crtd.barcode, crtd.item_description
, crt.put_away_location AS putAway
FROM
carton crt, carton_details crtd
WHERE
crt.carton_id = crtd.carton_id
AND crt.status = 'N' AND
( crt.carton_no like '{?cartonno}' or '{?cartonno}' like '%' ) and (crt.put_away_location LIKE '{?location}' or '{?location}' like '%')
GROUP BY
crt.carton_no, crtd.carton_id, crtd.part_no
ORDER BY
crt.put_away_location, crt.carton_no
I guess your query is always taking true ignoring or condition... try using Case
where
CASE WHEN {?cartonno} Like ""
THEN
'{?cartonno}' like '%'
ELSE
crt.carton_no like '{?cartonno}'
END
Note: I don't know which database you are using above is just an example of SQL... you can change it as required and use similarly for other parameter in where clause

BIRT report parameter multiple selection value "All"

I have a problem with creating default value of 'All values' for a cascading parameter group last parameter. Actually I don't neccesary need that value to be default, but that would be preferable.
I have tried where I create additional data set with the needed value and additional data set with value All which uses different scripted data source, and another data set with computed column with full outer join, that column uses this code
if(row["userName"]==null ){
row["All"];
}else{
row["userName"];
}
and in the last cascaded parameter JDSuser which I need that All value I have added default value (All users).
In the data set with one value All in open I have script
ii=0;
in fetch
if( ii > 0 ){
return false;
}else{
row["All"] = "(All Users)";
ii++
return true;
}
and in the query data set, in beforeOpen script in if statement I have
if( params["JDSuser"].value!=null && params["JDSuser"].value[0] != "(All Users)" ){
This is used if I haven't selected All users value, and this works, though if I select All Users, it retrieves me no data.
I'm creating from this source example actuate link for example rptdesign download
If someone could give me some help, I would be very grateful.
The way you generate "(All values)" item in your selection list seems to me over complicated but if i understood correctly your case this part is working fine, the problem is not in the definition of the cascading parameter but the way it is used in the main dataset of the report.
Furthermore we have to assume we speak about the same query & beforeOpen script involved in this topic. No data are returned because if we don't do anything special when this item "All values" has been selected, then those filters are still active:
and role.name in ( 'sample grupa' )
and userbase.userName in ( 'sample' )
There are a couple of options to handle this. An elegant one is to declare a dataset parameter linked to your report parameter "JDSuser", and use a clause "OR" such:
and role.name in ( 'sample grupa' )
and (?='(All users)' OR userbase.userName in ( 'sample' ))
Notice this question mark, which represents a dataset parameter in your query. It is not intrusive: the beforeOpen script doesn't have to be changed. You probably need to do something similar with the other filter role.name, but you don't provide any information related to this. One more thing, in order to avoid bad surpises may be you should choose as value something more simple without brackets such "_allitems", and set "(All items)" as label.
Please refer to this topic for more informations about handling optional parameters. See a live example of optional parameters in a cascading group here.

ssrs expression to split string possible?

so in my query i have select columnx from tblz
it returns 001.255556.84546
I want to be able to split this via '.' and put it into three columns.
column1 = 001
column2 = 255556
column3 = 84576
is this possible?
For info, in 2008 these dont work, you have to do the following:
=Split(Fields!returnedValue.Value, ".").GetValue(0)
Create three calculated fields with the following expressions:
=(Split(Fields!columnx.Value, ".")).GetValue(0)
=(Split(Fields!columnx.Value, ".")).GetValue(1)
=(Split(Fields!columnx.Value, ".")).GetValue(2)
I'm not sure it works or not, maybe give it a try. You might need to use IIF() statement to check values before getting them.
In SSRS you reference the field name, tell it the delimiter to use. Since you are not assigning to a variable, per se, you then need to tell it which part of the split string to use. In your example
=Split(Fields!returnedValue.Value,".")(0)
=Split(Fields!returnedValue.Value,".")(1)
=Split(Fields!returnedValue.Value,".")(2)
You would replace returnedValue with whatever the actual field name is, and place each one of those into your columns 1 - 3, respectively.
This answer was originally posted in the question instead of being posted as an answer:
=(Split(Fields!columnx.Value,".")).GetValue(0)
=(Split(Fields!columnx.Value,".")).GetValue(1)
=(Split(Fields!columnx.Value,".")).GetValue(2)