So, for example to access/change the "limit data using expression" property corresponding to a barchart I do:
from Spotfire.Dxp.Application.Visuals import BarChart
chart1 = Viz.As[BarChart]()
filter = '[CS_AGE] Is Not Null'
chart1.Data.WhereClauseExpression = filter
My question is: how can I access the "limit data using expression" property corresponding to a calculated values (The ones you create in a text filed using "insert dynamic item>calculated values")
there's probably a way to directly modify a control via the API if you know its ID (which you can get by adding the control and then looking at the HTML of its parent textarea), but I don't know what it's called.
that said, if you just need to change the expression being used for a Calculated Value, it'd be much simpler to use a Document Property instead. in your script, you can use
Document.Properties["MyPropertyName"] = "[Column] > 100"
and then in your Calculated Value (and any charts using the same limit), set the data limiting expression to
${MyPropertyName}
Related
I am developing a module for processing Loan Request for our business and I need to have different select options for a selection field based on another field's value. Is it possible to change the select options of this field based on other field value? I tried to use #api.onchange but I couldn't get the desired result.
No.
It's possible, however, to change the domain for a relational field:
#api.onchange("field1")
def _onchange_field1(self):
desired_domain = self._get_domain_for_field2()
return {"domain": {"field2_id": desired_domain}}
That would possibly fit your use case if you use a Many2one instead of a Selection field.
I have an date property for which I have created an document property as StartDate and EndDate, and in SQL query the same will be used to filter. In the Text Area , I am using it as Control Type: INPUT Field as this has two different values for start date and end date (as shown in fig: ), I need to merge this two date property into single Slider Control Type. I tried to use Functions using formula "First(DateProperty)". However I am not successful . Can someone help me on this?
I just found the reason for the issue as well, below are two points. i May be wrong as well:
1) To create an slider calendar, we need to create a function. This function will show the data tables which are of from different connections and In our analysis we have single connection and table for Each components .Due to this we are getting error called Cyclic Dependencies and Function is not working.
2) Next to create a simple table having only date property also causing problem as even this should be an Imported table and not linked to the external databases.
I am trying to limit the number of rows displayed on the visualization by having a property control(input field) in the text area. I was able to create the property control but wondering how to actually apply in the properties window under "Limit data using expression". Is there a way I can specify like RowCount = ${LimitRows} where the LimitRows would be my property control.
Assuming LimitRows is a numeric property (integer, real etc.) you can use the expression below to limit the data.
rowid()<=${LimitRows}
I have an information link that I want to restrict in spotfire when I add it as a data table so that certain data is excluded. I want to restrict column 'DAY' to the past 91 days.
These are the steps I have tried that haven't worked:
Added data table and clicked 'load on demand' (in the 'Add Data Tables' window) and then 'settings'
On the 'DAY' column, clicked 'Define Input'
Chose 'Range(fixed/properties/expression)' as the 'Input' for the selected parameter
Then as the 'expression' for the 'Min', used: DateAdd('dd',-91,DateTimeNow())
It returns an error when I try to add a transformation to the data or just returns no data when I add the data table. If I just restrict the data with a fixed value it works as expected but clearly this would mean that I would need to change the restriction everyday. I have also been able to restrict the data to a static date directly on the information link under the 'Filters' heading. What I really need is a dynamic restriction that is placed on in some way, in Spotfire, rather than directly on the data source (Oracle).
Would be grateful for any help! Thanks!
It couldn't recognize DateTimeNow(), which is a DateTime as a Date. Spotfire gets kind of picky about that sort of thing.
Replace the Expression used for Min with
DateAdd("dd",-91,Date(DateTimeNow()))
and it should work.
I have a requirement to populate the default value for an OptionSet in a Prompt-Response based on a value pulled in from a query within the Dialog. However, the default value field is disabled for both types of OptionSet.
Can anyone confirm if this is the correct behaviour as I can't think of any reason why you wouldn't be able to assign a default to an OptionSet at runtime?
This will mean duplicating the entire Page as I can't even add a Condition statement to conditionally use different Prompt-Responses unless anyone can offer a better solution?
When you do query that means you are getting a set of values, even if it's a single one.
So, yo can pupulate an Option Set from Query but not set a default value.
Anyway, default value field is not for OptionSets it's for text, numeric and DateTime responses.
I am not quite understand your last question.
Could you give more detail.
Long time since the question got asked.
The simplest answer is that you can´t set a default value to the option set.
However another sollution instead of duplicating the page, and that may be useful in a case like this, is a workaround with two queries.
Declare a variable of the type you want to be dynamic in the Query for the Option set.
Set the variable to a value that would give you the default Option set value you´re looking for.
Query for the data that you want to use with the dynamic type you want to use.
Check number of records the query returns.
If number of records is more than 0 you set the value of the variable to the dynamic vaule used in the query
Query for the same data again(!), this time with the variable instead of the previously used dynamic value, and use this one for the Option Set.
The result is: If you get hits from your query, the hits will be shown in the option set. If you don't get hits the "default" value will be shown.
Also don't think there is any reason why you wouldn't be able to set a default value for the Option set. Especially since the page locks up if the query used for the option set returns no hits.
Cheers.
/Henrik
Further to this I have come across a situation today where I have used some fetchxml to query data in a dialog and are now wanting to store that value within a variable but appears I cant and can only use this to show fields within an option set.
I appreciate the xml is returning a record and not a field but there must be away I can return first or default and store the returned value in a variable.