Argument not specified for parameter 'FalsePart' of 'Public Function - reporting-services

I'm trying to get a field condition to give me N/A when blank. Also to give me Fail on certain conditions. In addition, on a variable,pass/fail give me PASS or fail per the variable.
What is missing from my syntax?
=IIf(IsNothing(Variables!PassFail.Value),"N/A", iif(Variables!NameVer.Value = " x") Or (Variables!levPassFail.Value = "FAIL") Or (Variables!countPassFail.Value = "FAIL"),"FAIL", Variables!PassFail.Value)

The syntax was wrong but it's difficult to know exactly what you want to achieve.
The following will reproduce your original attempt
=IIF(
IsNothing(Variables!PassFail.Value)
,"N/A"
, IIF(Variables!NameVer.Value = " x" Or Variables!levPassFail.Value = "FAIL" Or Variables!countPassFail.Value = "FAIL"
,"FAIL"
, Variables!PassFail.Value
)
)
Note: I'm not sure if = " x" is a typo and should be = "x" but I left your original code in there.
If this does not help, please list the possible scenarios and the required output in each, then I can offer a more accurate solution.

Related

Kaggle competition submission error : The value '' in the key column '' has already been defined

This is my first time participating in a kaggle competition and I'm having trouble submitting my result table. I made my model using gbm and made a prediction table like below. the submission file has 2 column named 'fullVisitorId' and 'PredictedLogRevenue') as any other kaggle competition cases.
pred_oob = predict(object = model_gbm, newdata = te_df, type = 'response')
mysub = data.frame(fullVisitorId = test$fullVisitorId, Pred = pred_oob)
mysub = mysub %>%
group_by(fullVisitorId) %>%
summarise(Predicted = sum(Pred))
submission = read.csv('sample_submission.csv')
mysub = submission %>%
left_join(mysub, by = 'fullVisitorId')
mysub$PredictedLogRevenue = NULL
names(mysub) = names(submission)
But when I try to submit the file, I got the 'fail' message saying ...
ERROR: The value '8.893887e+17' in the key column 'fullVisitorId' has already been defined (Line 549026, Column 1)
ERROR: The value '8.895317e+18' in the key column 'fullVisitorId' has already been defined (Line 549126, Column 1)
ERROR: The value '8.895317e+18' in the key column 'fullVisitorId' has already been defined (Line 549127, Column 1)
Not just 3 lines, but 8 more lines like this.
I have no idea what I did wrong. I also checked other kernels but couldn't find the answer. Please...help!!
This issue was because fullVisitorId was numeric instead of character, so It dropped all the leading zeros. Therefore, using read.csv() with colClases argument or fread() can make it work.
I left this just because there could be someone else who are having the similar trouble like me
For creating submission dataframe, the easiest way is this
subm_df = pd.read_csv('../input/sample_submission.csv')
subm_df['PredictedLogRevenue'] = <your prediction array>
subm_df.to_csv('Subm_1.csv', index=False)
Noe this is assuming your sample_submission.csv has all fullVisitorId, which it usually does in Kaggle. Following this, I have never faced any issues.

Writing a function to split a data set into two

First, split the max_hf data set into two groups, Y and N.
def split_data_hf(old_data, new_data, variable, category):
new_data = old_data[old_data.variable == category]
split_data_hf(max_hf, max_hf1, inducted, 'Y')
split_data_hf(max_hf, max_hf2, inducted, 'N')
When I try to run this, I get the error that the variable inducted (which I am trying to pass through) is not defined. Can anyone explain why this is the case?
Theoretically it should work, and if I remove the variable input from the split_data_hf function and then add inducted in place of variable, then it runs just fine.
Anyways, I think I figured it out myself.
Instead of having
old_data[old_data.variable == category]
One should write:
old_data[old_data[variable] == category]
Then, when the input variable is passed, write "...." to pass the argument through.
Thanks!

SSRS complex IIf expression

I'm stuck on an expression. Below is programmatically what i want to do, but SSRS is not having it... How can I get this to work?
=IIf(Fields!TransTypeLabel.Value = "Hour", Fields!SalesAmount.Value, IIf(Fields!TransTypeLabel.Value = "Fee" AND Fields!CategoryId.Value = "TIME_FEE", Fields!SalesAmount.Value, 0), 0)
ake the final " , 0" out (but not the end brace). You also have missed .Value (or .Label depending on what you actually want) from the end of some field references. e.g. Fields!TransTypeLabel should. be Fields!TransTypeLabel.Value . Or maybe that was a type and should have read Fields!TransType.Label ?

Lua Naming a table from function input

If I do something wrong with the formatting or anything else, sorry, I don't use this site often.
I'm trying to make a function in lua that with take a name I give it, and create a subtable with that name, and when I tried something like this it just made the absolute name I put in the function's code.
NewSubtable =
function(SubtableName)
Table.SubtableName = {} --Creates a subtable called SubtableName
end
How can I make this create a subtable that is called by the name I give in the function when I use it? Is there an indicator or something to let the code know not to use the name given, but to use the variable assigned when I use the function?
EDIT: So whenever I try this, I get the the result "table index is nil" and it points to the error on line 4
I went and tested this but with a different input type, and it was just my fault. I didn't think that strings would the the value type you'd need for what I'm doing. My problem is solved.
Complete code:
Items = {}
NewWeapon = function(id, name, desc, minDMG, maxDMG)
Items[id] = {}
Items[id].Name = name
Items[id].Desc = desc
Items[id].MinDMG = minDMG
Items[id].MaxDMG = maxDMG
end
NewWeapon(Test, "test", "test", 1, 1)
Table.SubtableName is actually a syntactic sugar for Table['SubtableName']. To use the contents of variable SubtableName use the idom Table[SubtableName].

How can you check for null in a VBA DAO record set?

I have an optional field in a database that I'm pulling out using a DAO Record Set. I need to check whether or not the field is set before I concatenate it with other fields. So far I have the following code snippet which I've tried with both Is and = (that's the obviously wrong syntax [[Is | =]]) to no avail. It appears that if I use = it will not correctly compare with Null and if I use Is then it complains that it's not comparing with an Object.
While Not rs.EOF
If rs.Fields("MiddleInitial") [[Is | =]] Null Then thisMiddleInitial = "" Else thisMiddleInitial = rs.Fields("MiddleInitial")
If prettyName(myLastName, myFirstName, myMiddleInitial) = prettyName(rs.Fields("LastName"), rs.Fields("FirstName"), thisMiddleInitial) Then
MsgBox "Yay!"
End If
rs.MoveNext
Wend
If there's a simpler way to do this I'm totally open to it. prettyName takes 3 Strings as parameters and initially I was just trying to pass rs.Fields("MiddleName") directly but it threw up at a Null value. I'd prefer to do something more direct like that but this is the best I could come up with.
How about:
IsNull(rs.Fields("MiddleInitial").Value)
You could also have a look at this article which has some explanation about Null values in Access VBA apps and how to handle them.
For the example you show, Nz would work:
thisMiddleInitial = Nz(rs!MiddleInitial,"")
Or simply concatenating the string with an empty string:
thisMiddleInitial = rs!MiddleInitial & ""
Your question has been answered by Remou, seems to me, but it occurs to me that you may just be trying to get proper concatenation of the name fields. In that case, you could use Mid() and Null propagation in VBA to get the result.
I don't use separate middle initial fields, so my usual name concatenation formula is:
Mid(("12" + LastName) & (", " + FirstName), 3)
The "12" string at the beginning is going to be tossed away if LastName is Not Null and ignored if it is null, because the + concatenation operator propagates Nulls.
To extend this to include middle intials would look like this:
Mid(("12" + LastName) & (", " + FirstName) & (" " + MiddleInitial), 3)
Assuming your UDF is not doing some kind of complicated cleanup of nicknames/abbreviations/etc., this could replace it entirely, seems to me.
If rst.Fields("MiddleInitial").Value = "Null" Then
This works for me. I use MS SQL Database.
I think the NoMatch option might work in this situation:
If rs.NoMatch = True Then
I prefer using the below to account for both Null and Empty string values. It's a good check to use you have forms collecting values from users.
If Trim(rs.Fields("MiddleInitial") & "") = "" then