Is there a way to make flexdashboard respond to user input? - shiny

I am a new R user, currently developing a dashboard for my project. This dashboard displays the overall attendance summary for schools. I added a side bar and I want users to be able to select factors i.e. 'region' in the sidebar to see the results. The result that is currently being displayed is the overall result. How do I connect the sidebar to the various sections of the dashboard to enable the results to vary based on user selection?
The code can be found here https://github.com/Abdulkarim1990/kadiri1990/blob/42ca201fe90beda11098778c6702a8a833b1e75c/PLC%20dashboard%202.Rmd
I tried googling and varying the code to no end. I need help.

Related

PowerBI - How to create an approval process in PowerBI Dashboard?

I am working on the reporting project that uses PowerBI as the data visualization tool.
I need create a processing approval workflow on the PowerBI tool. After seeing the Dashboard, the employer can approve some exception cases and the workflow can direct connect with email or ticket system.
There are 2 cases:
Approve for the whole dashboard that supports to be easy. I don't have any problem here.
Approve for singular object/row in a table chart. So I must generate number of buttons according to the number of row, which I need help. I don't know how to generate dynamic number of buttons and attached to row. And how to program/code it to create a view or action to become an approval step.
Button PowerBI
In this screenshot, my plan is create buttons in each row and each button has the same function with parameter is username or IP. And after that I can send email to the user and notice him/her that his/her case is approve for exception.
I find this https://community.powerbi.com/t5/Community-Blog/A-simple-and-fun-guide-to-Microsoft-Flow-and-Power-BI/ba-p/151530. But it doesn't seem helpful. Anyone here has ever dealt with approval case like this.
Is PowerBI able to do the approval process like I want?
Thank you so much.
First: This kind of goes against the spirit of BI in general. BI is for data visualization, exploration, etc. It's not really a UI for inserting data and executing tasks. Maybe you want instead to have a front end that lets you do things, and only needs to handle a very limited dataset? PowerApps is good for that. If the dataset is less than 1000 rows, this could work.
Second: I'm pretty sure it's not possible to create a button (like one that you'd see in an HTML page) that does what you want it to do in a Power BI table visual.
Third: There is a "drill through" button capability, but this just lets you navigate from one area in the report to another, not send an email or execute a Power Automate flow or anything like that. You may have seen a button on a table visual, but it's misleading. It's not really programmable like an HTML/JS button on a website.
https://www.c-sharpcorner.com/article/create-a-drill-through-button-in-power-bi/
That said, within the last 1.5 years or so, we now have the PowerApps add-in available. You could create an app that utilizes your streaming dataset, create a gallery that looks at that dataset and creates a kind of table with buttons on it, and then each button is set to execute the flow you've created in Power Automate.
PowerApp Add in chiclet
All of this is very, extremely straightforward, but beware, the PowerApp will start to cost you extra money depending on where your data is housed. If it's a SQL server, you'll need both a premium PowerApp license and Power Automate license too.
Sorry for the not so great news, but this is kind of a limitation of Power BI.

Work with Power BI Matrix taking data from DAX statement

I have the following requirements:
The user will see a Power BI Matrix on a web page (as opposed to Power BI Desktop).
The web page should have three elements: a text field, a button and the Power BI Matrix (potentially included in a Power BI Report).
The user will enter the DAX statement in the text field and click on the button to direct the Matrix to take the DAX statement, execute it, and populate the data.
The user should be able to drill down in the Matrix.
The user may reenter a new DAX statement, refreshing the Matrix.
Now, all the documentation I could find, for example here, talk about the Matrix in Power BI Desktop (i.e. not web page) and the data taken by selecting manually tables/columns/measures (on the right side of the screen).
In Power BI Studio, I know that I can enter a DAX statement by creating a table in the top bar, for example if I have the DAX:
EVALUATE TOPN (3, branches)
I could create a table to populate the Matrix with:
BranchesTable = TOPN (3, branches)
But how to dynamically link a DAX statment defined at run-time to a Matrix on a web page?
This is not currently possible to do exactly what you want. You can dynamically change a data source and update the query used in a specific report but there isn't an API available (PowerBI REST or PowerBI JavaScript) to update what columns are on a visual in a report. You can get pretty close to what you want but the report cannot be displayed in View mode and it will have to be displayed in Edit mode so the user will have the ability to drag the fields generated from their updated DAX query results onto the Matrix visual manually if they submit a change.
Assuming you already have the pre-requisite App Registration setup and configuration completed and your ready to embed here are some steps to get close to what your looking for. If your not ready to embed there is some documentation below the 8 steps I provided to complete the pre-requisite setup to be able to embed.
Using PowerBI Desktop Create a template report that has a matrix visual and a connection to the data source you want to use. Be sure to set this report up using a specific query and NOT all tables in the data source whether its SQL or SSAS. (You specify the query under advanced options when you initially setup the data source in the report)
Setup a Power BI Data Gateway to the Data Source your report uses
Create a workspace on PowerBI.com to upload the report to
Using PowerBI desktop Publish the report you created in step 1 to the workspace you created in step 3
On your Web Application, when a user views the report viewer page, you need a way to identify each user. Lets assume you have UserId field that is a unique ID for each user. Call GetReports in group https://learn.microsoft.com/en-us/rest/api/power-bi/reports/getreportsingroup. You need to have a known report name plus the UserId. Lets assume its DynamicReport. So call GetReports and check if DynamicReport_UserId exists for the user trying to view the report viewer page in your web application.
In that API calls result from step 5, if the report does not exist for a user, use https://learn.microsoft.com/en-us/rest/api/power-bi/reports/clonereport to clone the template report you published in step 4.
Embed and display user specific template report (DynamicReport_UserId) for the user.
Have logic on the report viewer page so the user can submit and POST a DAX query. When they do a submit have logic to use https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/updatedatasources on the back end to update the data source in their report and then embed the report again with their DAX statement and changed data.
The visual isn't going to automatically update to the new fields from the new query that is submitted by the user but the available data fields they have in editor mode will change. The user will have to drag and drop the fields from their DAX query onto the Matrix visual or whatever visual type they are going to chose to use. You won't be able to just display a report in View mode since you don't have a way to programatically update what fields are on visual. The user may even end up seeing a broken visual initially because of the changed query and the visual referencing fields from the previously used query. You could use PowerBI Javascript API to hide the existing visual to improve the user experience of the user not seeing something broken.
Let me know if you have any specific questions about these API calls or how to use them.
Here is where I've been looking for the Power BI JavaScript functionality https://github.com/Microsoft/powerbi-javascript/wiki (Can't find anything specific to matrix Visuals. The JavaScript functionality for visuals generic to Visuals and not Visual Type like Matrix or Card)
Here is Microsoft's documentation on the available REST APIs and https://learn.microsoft.com/en-us/rest/api/power-bi/
Here are some good resources to learn more about embedding
https://learn.microsoft.com/en-us/power-bi/developer/embedded/register-app
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embedding
If you need drill down capability Hierarchies are a great option
https://spreadsheeto.com/power-bi-hierarchy/

How to send report directly to the printer?

I am using Apex 18.2. and ORDS as a printing server.
I have a master-detail page for selling items with a form on a table as the master region and an IG as the detail, joined to each other through assigning the PK to the FK IG's column.
There is another page with a report that can be queried through number of page items to get the documents with items sold in the previously mentioned master-detail page.
Whenever a user creates a document and submit the page, I will need to send the data of that document directly to the printer.
I mentioned the report page because I thought redirecting to it and assigning the PK to the corresponding page item could be a suggestion. But I know that I can create a shared component> report query too. But I do not know how could I send the data directly to the printer in either way.
I do not know if the report type - IR, CR or IG would make a difference. That's why I just referred to "report". But I'd need to know how it could be done with all types of reports.
Here is how a real-world scenario would look like,
You enter a supermarket, buy some items, go to the cashier, pay for what you've bought and get a receipt. The receipt is printed when the cashier saves the invoice.
I know this is not how web apps work, but this is the task I am facing.
I can think of branching to the report page after the invoice is saved and setting the PK value to the corresponding page item in the "search criteria" region to get the corresponding data then execute "window.print()". But there will be two problems then. 1- criteria region would be printed too, unless I hide it with a dynamic action or else. 2- The "print dialog box" of the browser will be displayed.
APEX 20.1 added native support for PDF printing of Interactive Grid regions. See this video: https://www.youtube.com/watch?v=e1yIFcEdW_o
If you can't upgrade, or if that support isn't sufficient for your needs, I suggest taking a look at APEX Office Print: https://www.apexofficeprint.com/index.html
APEX Office Print(AOP) can provide you the right solution.
Please try out the solution posted in the below link.
http://dgielis.blogspot.com/2020/01/print-pdf-from-oracle-apex-to-local.html
Few more examples:
How to print to an IP printer:
https://www.apexofficeprint.com/ords/aop_web/r/aop_sample_app_web/5034?session=13740999314649
How to print directly to a zebra printer
https://www.apexofficeprint.com/ords/aop_web/r/aop_sample_app_web/zebra-printer?session=6208952429228
(OR)
https://dgielis.blogspot.com/2020/01/printing-to-local-zebra-printer-from.html
If you are redirected to the Home page,
-> Click on examples in the left side menu.
-> Click on Print(highlighted in yellow).

Extjs 6 State management issue with touch devies

I am working in extjs6. I have grid with several columns as well as settings button on grid which hides/shows selected columns on click of apply button. I have implemented state related functionality for each column which will helps to decide which columns to be shown initially when user logs in.
Suppose i have grid with columns as-
{Id,
Name,
Description,
Author,
CreatedOn,
ModifiedOn}
I have selected Id, name and description columns. So as per my functionality, when i log out and again logs into my application, Code checks state of columns and displays only these three columns. Everything is working fine if i use application on Desktop/PC
But when i am performing above functionality with mobile or tab like touch devices, something weird happens. Using mobile if user A selects only some of columns of grid and get logout and log in again..He is able to see only selected columns as per requirement.
but now if i get login with same user A but on desktop/PC, grid is retrieving some wrong state resulting into display of all available columns. [Grid should display only those columns which user had selected before last logout].
So can someone please help me to know why this is happening.
ExtJS is saving state on the client side - meaning, if you login on a mobile phone, the state will be saved only on the phone in the browser.
If you log in on the Desktop, the state will be saved only in the browser with which you visited the site.
The state can be saved to Cookies, or better, LocalStorage
If you want to save states across devices, you need a server-side solution, you can check for one here

Magento products not visible via REST api addition

I'm currently running into the problem that I am using a webservice system to load products into magento.
I'm using the REST api in conjunction with Oauth to create products and assign a category. It works and when I go to the admin I can see the products as well as see they are properly assigned to the correct category. When I open the category management in the management console i can see i have (example: 106) items assigned in the category.
However, the problem is: It does not show in the site.. even with refreshing anything that is cache or index.
When I open up the management console and open 1 article and save it without changing any other property and then Save it. I can suddenly see the item in the front end webshop...
I'm lost to why this occurs.. also for 19k product updates it is becoming a bit of an annoying bit of work to update this amount of products since any bulk update method does not do the same as editing just 1 product at a time.
Any help is much appreciated.
In the end I have discovered the answer myself. Thought it might be nice to list it here as well.
In the 'rights' tab i added all the accessrights for the user using the api. This allowed me to read products etc. Very stupid mistake but somehow I overlooked this at first.
IF you'd expect security errors.. you wont get any. just empty lists and null responses.