syntax for properties in treemap expressions - spotfire analyst 10.8 - spotfire

I'm trying to create a treemap with user inputs for column selection in the hierarchy. I've got three (drop-down) document properties called treemap1, treemap2, & treemap3, the values of each are strings with column names. I'm struggling with the expression for the hierarchy axis. If I use...
<${treemap1} NEST ${treemap2} NEST ${treemap3}>
...the visualization works fine. I would however like to add a "none" option for the second & third controls, but when I do, once either is set to "none", the visualization doesn't render and gives the error "the expression is not valid after NEST...". This makes sense because [column] NEST null NEST null isn't a valid expression. So i'd like to add a case statement to get around the problem, to check for null values and change the expression accordingly. I've tried various permutations of this:
<
case
when "${treemap2}" ="" and "${treemap3}" ="" then ${treemap1}
when "${treemap2}" ="" then ${treemap1} NEST ${treemap3}
when "${treemap3}" ="" then ${treemap1} NEST ${treemap2}
else ${treemap1} NEST ${treemap2} NEST ${treemap3}
end
>
...but it never lets me save, always returning "the expression is not valid after NEST on line 4". I assume this is a syntax issue but I am stuck. So my questions are 1) can I use a case statement this way on a categorical axis and 2) if so, what needs to change in order for Spotfire to accept it?
Thanks in advance...

Best would be to add 3 buttons, each one associated to an ironpython script that takes the visualization as parameter (let's call it vis).
from Spotfire.Dxp.Application.Visuals import Treemap
vis.As[Treemap]().HierarchyAxis.Expression = "<${treemap1} NEST ${treemap2} NEST ${treemap3}>"
Do the same for the 2 others, with expression <${treemap1} NEST ${treemap2}> and <${treemap1}>.
You can even have only one script for the 3 buttons by setting the expression as parameter (let's call it e) :
from Spotfire.Dxp.Application.Visuals import Treemap
vis.As[Treemap]().HierarchyAxis.Expression = e

Related

ADF adding equals condition to existing if condition

I have an if condition in an ADF activity like below:
#if(
contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
,greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
),
false)
The if condition looks as the last update date in src vs my database. Want I want to include is an additional block of code that evaluates an outside parameter called TypeLoad.
The current set-up only allows for full loads, I want to be able to include delta loads.
Does anyone know how to include such a piece of logic to the existing if code?
equals(pipeline().parameters.FwkItem['TypeLoad'],1)
The above condition would for example evaluate the full or delta load.
All help is very welcome.
Thanks!
I tried to repro this in my environment. I gave the same expression
#if(
contains(activity('LookupWmkLastUpdateConfig').output,'firstRow')
,greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
),
false)
Same error function 'if' does not accept 2 arguments is occurred.
When the expression is looked into the reason for error, there were two closing parentheses near ,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark) ) .
Same is highlighted in the above image.
one parenthesis is removed and gave the expression as in below image.
#and(equals(pipeline().parameters.fwkitem,1),if(contains(activity('LookupWmkLastUpdateConfig').output,'firstRow'),greater(
activity('LookupLastUpdateSrc').output.lastModified
,activity('LookupWmkLastUpdateConfig').output.firstRow.NewValueWatermark)
,false))
Expression doesn't produce any error now.

MATLAB selecting items considering the end of their name

I have to extract the onset times for a fMRI experiment. I have a nested output called "ResOut", which contains different matrices. One of these is called "cond", and I need the 4th element of it [1,2,3,4]. But I need to know its onset time just when the items in "pict" matrix (inside ResOut file) have a name that ends with "*v.JPG".
Here's the part of the code that I wrote (but it's not working):
for i=1:length(ResOut);
if ResOut(i).cond(4)==1 && ResOut(i).pict== endsWith(*"v.JPG")
What's wrong? Can you halp me to fix it out?
Thank you in advance,
Adriano
It's generally helpful to start with unfamiliar functions by reading their documentation to understand what inputs they are expecting. Per the documentation for endsWith, it expects two inputs: the input text and the pattern to match. In your example, you are only passing it one (incorrectly formatted) string input, so it's going to error out.
To fix this, call the function properly. For example:
filepath = ["./Some Path/mazeltov.jpg"; "~/Some Path/myfile.jpg"];
test = endsWith(filepath, 'v.jpg')
Returns:
test =
2×1 logical array
1
0
Or, more specifically to your code snippet:
endsWith(ResOut(i).pict, 'v.JPG')
Note that there is an optional third input, 'IgnoreCase', which you can pass as a boolean true/false to control whether or not the matching ignores case.

Appian "Only Show when" Expression: when date value is not null

I'm using Appian to create a interface form. I'm making the form dynamic. There's a textbox that needs to only appear when certain variables are true. Appian has a nice feature for that, which allows you to add an expression to an "only show when" function.
It currently holds the expression:
edate(today(), -804) >= ri!GeboorteDatum
ri!geboortedatum is the variable on the form
I need to add another expression that says: only show when date value is not null. I tried everything but can't get it to work. anyone got a solution? The programming language seems to be simular to excel.
Maybe something like
edate(today(), -804) >= ri!GeboorteDatum & isnull(ri!Geboortedatum)
Answer is if(isnull(ri!GeboorteDatum), false, edate(today(), -804) >= ri!GeboorteDatum)

How can I make PyCharm break when a variable takes a certain value?

I have a big dictionary and some of the elements occasionally end up with illegal values. I want to figure out where the illegal values are coming from. PyCharm should constantly monitor the values of my dictionary, and the moment any of them take the illegal value, it should break and let me inspect the state of the program.
I know I can do this by just creating a getter/setter for my dictionary instead of accessing it directly, and then break inside the setter with an appropriate condition.
Is there a way to do it without modifying my code?
I'm not sure if this answers your question but you can set a breakpoint on the line of code you want to break at, right click on that break point once it is set and then apply a condition.
An example of such a condition could be:
x > 5
Once you are at the stage in your loop/code where this condition is true i.e. when x = 6 then it will break and you can inspect all the current values/ status of your code.
Hope this helps

SSRS - How to get a part of a string

I have a parameter called Analyst group in this format :
[Dimension].[Analyst Group].&[Nl.Workplace.Foundation]
I want to pass this parameter to another report, to filter data. Its a multi value parameter. But the other report only accepts it in this format : [KanBan].[Analyst Group].&[Nl.Workplace.Foundation]
So im trying to isolate the "Nl.Workplace.Foundation", so i can do the following thing in the Go To Report parameter expression :="[KanBan].[Analyst Group].&["& --Isolated analyst group-- &"]" to create the desired format.
So what i need is to extract the part between .&[ and ]
But i really have no idea how to isolate that part of the string.
Found a solution! If i just use the Parameter.label instead of Parameter.value it automatically does what i want!
A different solution has been found, but I will still answer the initial question. It could help.
So what i need is to extract the part between .&[ and ]
You could use a regex.
This may not be the fastest way but it can handle most of the situations.
So let's assume you have a string containing:
[Dimension].[Analyst Group].&[Nl.Workplace.Foundation]
And you want to get the following string:
Nl.Workplace.Foundation
Just use the following expression:
=System.Text.RegularExpressions.Regex.Match("[Dimension].[Analyst Group].&[Nl.Workplace.Foundation]", "\.&\[(?<NWF>[^]]+)\]").Groups("NWF").Value
In the expression, replace the input string with your dynamic values, like for example:
=System.Text.RegularExpressions.Regex.Match(Fields!Dimension.Value & "." & Fields!AnalystGroup.Value, "\.&\[(?<NWF>[^]]+)\]").Groups("NWF").Value
I'm keeping the formula as simple as possible so that you can easily adapt it, with, say, handling the case where an input string will not have a match (with the above query it will return #Error).
You could do this by adding an IIF() or better, use a custom function that you can reuse in several places and will reduce the length of your expression.

Resources