Visualization Tableau - Remove an option from a filter - visualization

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

Related

iText DITO - How can I use a fields Data name as a reference in a calculation?

In iText's DITO template designer product, I have one field which has a fairly complex calculation. In another field, I want to use the result of that calculation.
The tooltip says "Identifier used for referencing fields in calculation expressions". So I assumed if I named it blah I can use it in a calculation in another field like this: sum({{blah}},42) (e.g. add 42 to the value of blah). But if I do that I get the error
Unable to resolve reference: "{{blah}}" in node with tag: <span> and text:
The iText DITO documentation does not elaborate on this feature at all. I'm evaluating iText DITO and there does not seem to be any way to get support while evaluating the product.
Suppose I have a field with a very complex calculation. In order to reuse the calculation result, I can do the following:
Give a name to this field (in the image below I've chosen name "total")
Insert a calculation to another field (where I want to reuse "total")
Add "total" as the calculation's body:
That's it, now the total value is reused:
I think the documentation you are looking for is at https://kb.itextpdf.com/home/ditokb/latest/manuals/itext-dito-editor/calculations
You have to give the rich text element a name in the properties to be able to reference it on other rich text element and/or calculations.
See image example at https://kb.itextpdf.com/home/ditokb/files/latest/68620314/68620309/1/1660291029000/image2020-5-27_17-56-41.png

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.

Tableau: Switching worksheet

I have a tableau report that has a "Style" parameter that controls which worksheet to view. For example, if the Style="Chart" it will display the Chart worksheet, and if the Style="Summary" it will display the summary worksheet. I got this feature working as a charm. What if I want to add another dropdown data to the Style parameter "Both" that will display both "Chart" & "Summary". Is this possible? Can anyone provide me insights on how to accomplish this in tableau?
If you filtered your worksheets by the Style parameter, you could instead filter with a formula condition. Go to the Condition tab in the filter, and select By Formula. Something like this may work for your Chart worksheet:
[Style] = 'Both' OR [Style] = 'Chart'
If you used something other than filters to select the appropriate worksheet, please either explain how you're doing it or share a tdx.

Nested Filter options in Spotfire

I am learning to create reports using spotfire. Could you please help me to understand the feasibility.
Is it possible to change the filters based on the previous selection(filters has to be altered based on the previous section)
For Example:
I have a following table, with three columns.
Filter1 Filter2 Data
Name Name1 test1
Age Age1 test2
Location Location1 test3
I am planning to have filter options based on the column Filter1 and Filter2.
Is it possible to create a drop down with the values "Filter1" and "Filter2"?
Is it possible to modify the list of filter options, based on the first drop down selection.
For example. if "Filter1" is selected in the drop down. The list of filter options should be "Name","Age", "Location".
if "Filter2" is selected in the drop down. The list of filter options should be "Name1","Age1", "Location1".
Thank you
We can also create a cascading drop down list through the following steps.
Create a “property Control – Drop down list” myDropDownList
Select the “Unique Column Value ” to populate the drop down list (values).
Go to “Insert -> Calculated Column”
Use a simple conditional statement something like If([Value1] = ‘${myDropDownList}’, [Value 2], NULL)
Use the newly created column in the text area filter. This will be updated based on the previous section.
Thanks.
I have a solution utilizing JavaScript to effectively toggle between hidden DIVs. I'm not aware of a way to manipulate the filter object and which column it points to in the Text Area through the API. If someone does know a way I'd love to hear it!
Here is my solution with JS:
Set up your Text Area with a Drop Down for your selection as a column selector (with columns of interest chosen through the "Select Columns..." dialogue), a label displaying that selection (we will hide this, I realize it seems redundant), and 2 filters for your 2 columns.
Right click your text area and click Edit HMTL. Utilizing the HTML below, modify your HTML to match. You will want to have the 1st DIV as your drop down, the SPAN as your label which displays that drop down's property, and then the last 2 DIVS (LETTER and NUMBER in my case) as your two filters. Make sure the DIV id name matches your column name exactly.
<DIV><SpotfireControl id="8dc9d8974bde445cab4c97d38e7908d6" /></DIV>
<SPAN id=docProp style="DISPLAY: none"><SpotfireControl id="1311015997cd476384527d91cb10eb52" /></SPAN>
<DIV id=LETTER style="DISPLAY: none"><SpotfireControl id="760ae9ffd71a4f079b792fb5f70ac8b4" /></DIV>
<DIV id=NUMBER style="DISPLAY: none"><SpotfireControl id="488ef4b1289440d5be24b0dd8cfc3896" /></DIV>
Next we will implement the JS. To do so, click the +JS button in your Edit HTML. The JS itself is below. You'll want to change my inputs of LETTER and NUMBER in the first 2 getElementById references where we set them to display:none.
filter = function(){
input = $("#docProp").text().trim() //Take the text from our hidden label and trim it from any white space.
document.getElementById("LETTER").style.display = 'none'; //Reset DIV
document.getElementById("NUMBER").style.display = 'none'; //Reset DIV
document.getElementById(input).style.display = 'block'; //Set new display
}
//Run this function every 333ms or other length of time desired to update your filters.
setInterval(filter,333)
//Larger numbers mean slower response and better performance vs. faster response and worse performance. Tune as necessary.
Alternatively instead of scanning every X milliseconds (can cause some performance drag), you can make a JS button to run it manually. e.g. $("#divIdForButtonPlacement").button().bind('click',filter)
A few images of my setup for testing are shown below. Let me know if you have any questions regarding this.

How to use Parameter field in a record selection "like" statement?

I have designed a report to pull data fields based on a record selection formula that uses a "like" operator that looks for a substring match in a particular field's data, as so:
{rct.serno} like "*9842*"
(due to the free-format way data is stored in the given field, I have to do a substring match to find the relevant rows in the DB.)
This works fine. Instead of manually editing the record selection formula every time, though, I thought to use a Parameter field ("{?TagNum}") to prompt the user for the desired string, and then use that in the record selection formula like:
{rct.serno} like "*{?TagNum}*"
Crystal does not throw an error when I save this record selection formula, but it does not return any records after the report is refreshed, and a parameter value is entered. How can I properly use the parameter value in a record selection substring match?
You're really close to the solution. You can modify the formula in the Select Expert. Just click the Select Expert icon (or from the Report menu). Then click the Formula Editor button. Concatenate or add an asterisk onto the beginning and end of the parameter using the + operator, like this:
{Customers.LastName} like "*" + {?pLastName} + "*"
Let me know if that helps.
~ Nathan