I'm in a tough pickle here, using SSRS and trying to feed a NULL value, with others, from a multi-valued parameter into the stored procedure used for the dataset.
The values the user selects in the multi-value parameter of the report, are fed to a single input parameter in the stored procedure. For example, the multi-value drop down called #Color can feed 'Red','White', and 'Blue' to the stored procedure's '#ColorList' parameter. The stored procedure uses the parameter for SQL statement building functions and gives the result set. I want to add the NULL value to the multi-value parameter in addition to the values, as some records do not have a Color value.
Unfortunately, I don't have permissions to the modify the stored procedure so I can't use the ISNULL(Value,'') work-around or change anything with the 'IN' syntax. The stored procedure is being executed in the report as follows:
EXEC StoredProc
#Name = #Name
#ColorList = #Color
#Color is passed using a JOIN expression
=JOIN(Parameters!Color.Value,",")
Any suggestions?
It sounds like you undertand your situation well: You cannot pass the value of NULL as a parameter, because NULL simply is not a value and has no value. You could pass the string "NULL" as the parameter #color, but you'd probably be better off creating a colorfully-named (shall we say, distinctive?) distinctive variable, such as noColor just to keep things clear.
Related
i'm using io.confluent.connect.avro.AvroData.fromConnectData to convert message before serialization.
AvroData uses struct.get(field) to get values which in turn replaces nulls with schema default values.
as i understand from avro doc default values should be used for schema compatibility when reader expects field that missing in writer schema (not particular message).
so my question is: is it correct way to replace nulls with schema default value? or maybe i should use another way to convert messages?
The miss understanding is that the default value is not used to replace null values, it is used to populate your field value in case that your data does not include the field. This is primary used for schema evolution purposes. What you are trying to do (replace null values coming as part of your data with another value) is not possible through avro schemas, you will need to deal with it in your program.
Specifically for a boolean value, will Azure Search filter query perform type coercion? Every single filterable value that a user might select for their search in my application is a string value. When building my OData query, I don't want to have to perform logic to check on this one boolean value to adjust the query string accordingly when a dozen other values are just strings. I just want to be able to wrap every single value in a single quote, the logic is more simple this way, as opposed to wrapping values in single quotes for everything except boolean values, etc.
I don't have the means to test this while our index is being built but I am writing our client side code for this in preparation for when it does exist.
So, for example, let's say I have a boolean flag called "isDeleted" which indicates if a record in my database has been "sudo" deleted or not, that is added to my search index. If I add the following filter to my payload post to Azure Search, will I get records back that this value is true:
...
"filter": "isDeleted eq 'true'"
...
Notice I am wrapping the "true" value in single quotes, indicating it could be a string. Will the Azure Search engine perform type coercion on this and pull back records, or is a valid filter only
...
"filter": "isDeleted eq true"
...
Thanks!
Azure Search only supports type conversions defined in the OData standard. Specifically, widening numeric conversions are supported, which is why you can compare a double with an integer, for example. Azure Search does not allow any automatic conversions to or from strings in filter expressions.
Is there any difference in performance or another difference or are both the same thing (as per the lookup fields in the TADOquery and TCustomADODataSet)?
I have read the Help files, but I didn't found anything explaining on this.
The Lookup() function is a virtual function of TDataSet.
Being a virtual function means that the implementation can change from class to class.
Because of this, the documentation has different comments that varies from each TDataSet descendant.
Let's take a closer look:
TDataSet's Lookup():
Implements a virtual method to retrieve field values from a record
that matches specified search values.
See more here
Note this remark at the end of the document:
Descendant classes that are not unidirectional override this method so
that it locates the record where the fields identified by the
comma-delimited string KeyFields have the values specified by the
Variant or Variant array KeyValues. In classes that implement Lookup,
it returns a Variant or Variant array that contains the value or
values of the fields specified by the comma-delimited string
ResultFields on the specified record.
TCustomADODataSet's Lookup():
Here, the remark above is happening in pratice. Note, in this implementation there is no call to inherited.
The Documentation says:
Retrieves field values from a row that matches specified search
values.
Details here
Now, you can only understand the difference by digging into the source code. At the end, you will note that there is no difference at all. You will realise that the lookup fields will just call Lookup() function:
1. A lookup field is like a calculated field.
Is affected by the AutoCalcFields property (See here)
The same function the fires OnCalcFields event is responsible for
calling CalcLookupValue
UniDirectional DataSet also do not have Lookup Fields. (See
here)
2. The Lookup Field calls the Lookup() Function
On this, there is no documentation, you will have to see for yourself:
procedure TField.CalcLookupValue;
The Lookup() arguments is filled with the TField properties: FLookupDataSet.Lookup(FLookupKeyFields,
FDataSet.FieldValues[FKeyFields], FLookupResultField);
The Lookup() function consumes all related properties from the lookup field, as you can see above:
FKeyFields = TField.KeyFields
FLookupDataSet = TField.LookupDataSet
FLookupKeyFields = TField.LookupKeyFields
FLookupResultField = TField.LookupResultField
how can I set default value for an IN parameter of a stored procedure or
how can I set an IN parameter to optional in a stored procedure
in HSQLDB?
I have already tried all of the solution what I learned in SQL generally
and I have already red through the HSQLDB reference
and unfortunately I didn't find the answer yet.
Do you have any experience with this?
Thank you for your answer in advance!
K.
You cannot set default values for an IN parameter. This is a non-standard feature of some products.
There are ways to add some flexibility:
Inside the procedure check if the parameter is NULL and if so, use a default value
Define two or three versions of the procedure. The versions with fewer parameters call the one with the largest number of parameters. The full version checks for NULL and used the default.
I have two tables in my Report. Both use two separate Data Sets, which get data from the same Stored Procedure. Now, I want the data sets to get different data based on different parameter values. Is there a way to achieve that? I am using SQL Server 2008-R2. Thanks in advance...
Within the Report Data screen (Ctrl+Alt+D), you can tie both datasets up to different parameters.
Add your parameters
Open up the Datasets properties
Go to the parameters section
Add the required parameter and give it a name the same as your Stored Proc parameter e.g. #EmployeeId
providing the query is marked as type "Stored Procedure" (in query section), this will pass the parameter over on selection. Repeat the process for the other dataset