The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
AndreaF
2 years agoContributor III
Connector rule - drill back IF statement
Hi, I am experiencing a strange behavior with a piece of code in the drill back of a connector rule. I have the following piece of code: If StageTableFields.StageSourceData.DimUD1.XFEqualsIgno...
- 2 years ago
Thank you Daniel, I have used the below to check what was happening with the IF statement
Throw New XFUserMsgException(si,sqlScript.ToString,"","")and I discovered that the StageTableFields.StageSourceData.DimUD1 command returns the string "UD1", while what I wanted was the source value (e.g. "Zero"), so the correct code is the following
If sourceValues.Item(StageTableFields.StageSourceData.DimUD1).ToString.XFEqualsIgnoreCase("Zero") Then whereClause.Append("And (Department IS NULL) ") Else whereClause.Append("And (Department = '" & SqlStringHelper.EscapeSqlString(sourceValues.Item(StageTableFields.StageSourceData.DimUD1).ToString) & "') ") End IfIt was only a coincidence that in my original code was returning rows with Null Department when excluding the Else condition.
AndreaF
2 years agoContributor III
Thank you Daniel, I have used the below to check what was happening with the IF statement
Throw New XFUserMsgException(si,sqlScript.ToString,"","")and I discovered that the StageTableFields.StageSourceData.DimUD1 command returns the string "UD1", while what I wanted was the source value (e.g. "Zero"), so the correct code is the following
If sourceValues.Item(StageTableFields.StageSourceData.DimUD1).ToString.XFEqualsIgnoreCase("Zero") Then
whereClause.Append("And (Department IS NULL) ")
Else
whereClause.Append("And (Department = '" & SqlStringHelper.EscapeSqlString(sourceValues.Item(StageTableFields.StageSourceData.DimUD1).ToString) & "') ")
End IfIt was only a coincidence that in my original code was returning rows with Null Department when excluding the Else condition.
DanielWillis
2 years agoValued Contributor
Nothing seems to beat fresh eyes on an issue sometimes!
Related Content
- 9 months ago
- 3 years ago
- 2 years ago