pentaho first steps: link combobox to chart - charts

I'm completely new to SO, Pentaho, and have a (very) limited knowledge on js and jquery.
I need a simple requirement: whenever my combobox changes (2 values: budget or estimate), I need to reload my chart.
What I've tried so far:
In Components panel, I've added a
-Simple Parameter
--Name: param_budget_or_estimate
--Property value: budget
-Select component
--Name: BudgetEstimate_Select
--Parameter: budget_or_estimate
--Datasource: budgetestimate_query
-CCC Pie Chart
--Name: piechart_linecosts
--Listeners: added param_budget_or_estimate
--Parameters: arg param_budget_or_estimate, value param_budget_or_estimate
--Datasource: budgestimate_piechart
In Datasrouces panel, I've added a
-sql over sqlJndi query budgetestimate_query, named budgetestimate_query, that returns a
select distinct budget_or_estimate from budget_or_estimate;
-sql over sqlJndi query named budgetestimate_piechart, that returns a
SELECT COST_LINE_NAME
,amount
FROM VI_LINE_COSTS_PIE_CHART
WHERE budget_or_estimate=${param_budget_or_estimate}
;
Yet, I fire up my dashboard and changing the combobox changes nothing.
What am I doing wrong?
Thanks in advance!

First, you need to create a parameter. Let it be named parameter_one.
Then, you set your select component to have parameter_one as Parameter property (so it propagates the onchange event's value to the parameter).
Now, the piechart must have parameter_one as listeners, and parameter_one as parameters (arg=parameter_one, value=parameter_one). So, you declare that whenever parameter_one changes, the piechart should be reoloaded (listener) and that parameter_one's value is relevant to the calculation (parameter).
Finally, the piechart DataSource should look like:
select A.id,A.value
FROM
(
select '1' as id, 10 as value
union all
select '2' as id, 20 as value
) A
WHERE A.id=${parameter_one}
;

Related

SetAscending Business Central Sales Order List

I am attempting to use the SetAscending in Visual Studio Code for Business Central Sales Order List Page. It works to set the Sales Order "No." field to descending however it does not reset the scrollbar to the top of the page. I've tried adding it to multiple places and it sorts the page but no scrollbar update. What code could I be missing?
Places I've added it to:
Sales Order List Page Extension - OnAfterGetRecord and OnAfterGetCurrRecord
Sales Order List Page Events - OnOpenPageEvent, OnAfterGetRecordEvent, and OnAfterGetCurrRecordEvent
trigger OnAfterGetCurrRecord()
begin
rec.SetCurrentKey("Document Type", "No.");
rec.SetAscending("No.", false);
end
You must tell the page to navigate to the new first record.
In the OnOpenPage trigger you do the following:
Rec.SetCurrentKey("Document Type", "No.");
Rec.SetAscending("No.", false);
if Rec.FindSet() then; // use if-then to avoid error if there are no records within the filter
You have 3 methods to use as FIND
FindFirst = Find the first ocurrence of your filters
Findlast = Find the last ocurrence of your filters
FindSet = Find a set of ocurrence of your filter
You can use all of them with the repeat and until statements to loop through records.
The difference between FindFirst and FindSet for Repeat and Until is that FindSet find a Set of registers Whilst FindFirst find only one so FindSet it is more performant.
For your case
You need to modify the property sourceTableView. This is a page property. FindSet is used for variables not for DataSourceTable in page list.
Create a key in your table and then put this key in sourceTableView property of the page.
This is what worked for me. Since, this is a standard list page in Business Central I could not modify the SourceTableView. I had to use two triggers to first sort and the move the cursor to the top of the list.
trigger OnAfterGetRecord()
begin
rec.SetCurrentKey("Document Type", "No.");
rec.SetAscending("No.", false);
end;
trigger OnOpenPage()
begin
rec.FindLast();
end;
I was testing answers and reading about this subject on learn.microsoft.com, but the only trick that works is the following:
trigger OnOpenPage()
begin
Rec.SetCurrentKey(SystemCreatedAt);
Rec.Ascending := false;
end;
Note: I'm sorting by a datetime object. But the clues are: OnOpenPage trigger, SetCurrentKey and Ascending property instead of SetAscending. This is the unique solution that leaves the scroll bar on the top, at least for me.

PowerApps - autofill date for newform

Using PowerApps, how can I get the current date to be autofilled into a new form?
Does the code go into the IconNewItem1 function from the parent BrowseScreen1?
NewForm(EditForm1);Navigate(EditScreen1,ScreenTransition.None)
as something like ...
BrowseGallery1.Selected.Date = Now
Or does the code go in the EditScreen1 / EditForm1 area as a rule?
Any guidance or suggestion would be appreciated.
You would do that in the form itself (or the date picker control of the form). Select the card that has the date value, and in the right-side pane select the 'Advanced' tab. You'll need to unlock the card to change the properties, and when you do, change the Default property of the card from
ThisItem.DateTimeColumn
to
If(EditForm1.Mode = FormMode.New, Now(), ThisItem.DateTimeColumn)
Where DateTimeColumn would be replaced with the name of the column in your data source, and EditForm1 would be replaced with the name of the form control.

Access 2016: Form shows now results when using a query parameter from included ComboBox

I'm banging my head against a wall trying to solve something I'm sure is simple. I'm using Access 2016 and trying to build a form which essentially has a filter combo box in the header.
Let's say the form is called myForm and the comboBox cboStatus. The query contains a field called status.
In my query, I basically have SELECT * FROM myQuery WHERE [myQuery].[status]=[Forms]![myForm]![cboStatus]. Eventually, I intend to add a VBA-based event on the COmboBox to update the query when it changes, but for now, I select a value and hit Refresh All on the form, just to test it.
No matter what value I have in the ComboBox, no records display in the form. What am I missing? Thanks in advance!
If status is a text field then you need
SELECT * FROM myQuery WHERE [myQuery].[status]= "'" & [Forms]![myForm]![cboStatus] & "'"
I think I have solved it! I didn't define the form element (comboBox) as a parameter in the SQL query. Adding:
PARAMETERS [Forms]![myForm]![cboStatus] Text ( 255 );
seems to have fixed it! Wanted to make sure I responded in case anyone else has the same issue!

Symfony2 DOMCrawler - How to select second option of a select tag

I'm trying to select the second option in a <select> tag with the DOMCcrawler. First of all, I select the second form in the page:
$form = $DOMCrawler->filter('form')->eq(1)->filter('input[type=submit]')->form();
Then I could change each value of the form by:
$form['value'] = "new value";
but I don't have a fixed key for each value. Instead, I have a variable number. E.g. I could have something like:
$form[1234];
but also could be
$form[4321];
depending on other variables. So I need to change the form values without knowing the key values, but its position in the node <form>. E.g. something like $form->firstKey();
Also, I want to select the second option inside <select> tag, not a fixed value. Any ideas on how to achieve it?

Visualization Tableau - Remove an option from a filter

This is the link of my visualization: My dashboard
In the tab "Cursos por ciclo", I would like to know how to remove the option "PTJE.TOTAL" from the filter "CURSO".
You can do this by creating a new calculated field.
Right click on CURSO and select "create calculated field" then use this formula:
IF left([CURSO], 4) <> "PTJE" THEN [CURSO] END
Basically, this means: if the value does not start with "PTJE" then include it.
Then use the new calculated field as a filter, you will see that it does not include the "PTJE. TOTAL" value (it has been replaced with nulls now). So when you apply a quick filter the "PTJE. TOTAL" value won't appear.
Note: Normally I'd use something simpler like:
IF [CURSO] <> "PTJE. TOTAL" THEN [CURSO] END
but that is not working with your data for some reason.
Also, you can read more about calculated fields in Tableau here:
http://onlinehelp.tableausoftware.com/v6.1/public/online/en-us/i181523.html