Setting Default Value to 'None' for Parameter (Azure Data Factory) - azure-data-factory

I am currently trying to parametrize a dataset so that the compression type of a binary file can be set without creating a new dataset.
The issue that I am having is that I cannot seem to make the compression type default to 'None' while still having a parameter. I have tried typing in null, '', etc. but nothing seems to work. The pipeline will either not run, or it returns an error that it cannot be null, invalid type "" etc. Any advice would be appreciated.

--Update
It so appears this is something to do with how Binary dataset is designed.
Going through the Binary Dataset code I can see the below difference in usage of compression method/code block.
It indeed leads to an error for default value set to None.
And when compression type is set to None
You can reach out to support for official response or log an issue here or share an idea here
Also, it works fine when using the Default None option from the dropdown for compression properties in case of Binary dataset.
Checkout..
However...
I have tried this at both source and sink with csv files - Source.csv and Source.csv.gz both ways
You can set the parameter default value to None. And it works just fine.
Same is expected for Binary format Dataset properties but in vain 😕

Not an obvious solution, but you can add a parameter named "CompressionType" to your dataset and then edit the dataset json to add this under "typeProperties":
"#if(equals(dataset().CompressionType,'None'),'no_compression','compression')": {
"type": "#dataset().CompressionType"
}

Related

Dataset Empty parameter value

I have an xml dataset, I want to parametrize the compression type to treat .xml and .xml.gz files with the same pipeline :
When I put 'gzip' value in compression type it reads xml.gzip file. I want to know what value I should put to read uncompressed .xml file because it does not accept empty value. It is able to read xml file just when I delete the compression_type parameter
You should pass "None" and it should work out .
I feel "None" is more of a workaround in this particular case. "None" is still a string value, not empty.
In my scenario right now, I have an Excel dataset. I want to make every parameter as generic as possible, including the file path/name, sheet name, and the range. The value of "Range" under Connection tab allows empty value. However if I specify it as #dataset().DataRange and leave my parameter DataRange empty, I cannot preview the data or submit the pipeline because it complains that the value cannot be empty.

What is the upper limit of ADF string variable?

Is there any character limit on ADF string variable ? I am trying to store a big script in ADF variable , which seems to be working fine but this is a dynamic script so I wonder if there is any storage limit to it? My use case is that based on some tabular input , I am forming a script and need to send it to some compute , I didn't find any other solution apart from using a string variable.
There isn't upper limit of the ADF string variable. No documents talked about it and can't find any useful messages.
But I tested and found that you can set variable value length until you get the browser SBOX_FATAL_MEMORY_EXECEEDED error. I put a 16M string to the variable value:
You also could set a big size string as the variable value to prove that. The key is that I don't know the how to get the SBOX_FATAL_MEMORY. I googled and found nothing about it.
Hope it's useful for you.

Why output value is cut when adParamInputOutput is used?

I have stored procedure which has VARCHAR(MAX) OUTPUT parameter. The parameter is used to both pass and return large string value.
It is working perfectly when it is executed in the context of the SQL Server Management Studio.
The issue appears only in the ASP page. Here is the code:
cmd.Parameters.Append cmd.CreateParameter("#CSV", adBStr, adParamInputOutput, -1, 'some very large string goes here')
I am able to pass a large value (more then 4000 symbols) but the return value is cut. I have try to replace the adBStr with adLongVarWChar and adLongVarChar but I get the following error:
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
I guess the problem is caused by the adParamInputOutput. So, I am generally asking for a parameter type that will work in both direction with maximum symbols.

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.

How to pre select all values of input control by default in ireport

How to select all values of input control by default on the launch of the report?
If you are using a list input control and you have a fixed number of values in the list, you can select them by setting the Default Value Expression for your parameter to this (filling in the appropriate values):
java.util.Arrays.asList(new String[] {
"Value1",
"Value2",
"Value3"
});
If you make the input control optional, the user could leave the selection blank to select all values also. This is generally the way I do it.
Tom's solution works if report's scripting language is set to Java. Otherwise for Groovy it gives an error something like:
Errors were encountered when compiling report expressions class file: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: calculator_*: unexpected token
In the case where you have to use Groovy (e.g. for simpler date manipulation - $P{inputDate}.plus(1)), simply set Default Value Expression for your parameter to this:
["Value1","Value2","Value3"]