legends and url on google graph points - google-visualization

I have a scattergraph with several points on it.
I'd like to have some text and possibly an url, so I can go to the page specially for that item represented by that point.
(The graph is wholesale price vs sales price, I want the legend to show the item number, title, and go the product page for that item when I click on the point)
I get the data as json via ajax; part of the data is
'
"rows": [
{"c": [{"v": 24,"f": null},{"v": 399,"f": null}]},
{"c": [{"v": 24.9,"f": null},{"v": 369,"f": null}]},
....
`
I haven't been able to find documentation on how to do it, but I'm sure I have seen it.

Related

How to filter based on the URL of an image in Google Sheets?

I'm trying to create a filter view in Google Sheets that will only show certain rows of the spreadsheet based on the last few characters of the URL of the images that are inserted in every row. For example, most rows have an image that is simply named "image1.png", "image2.png", "image3.png", etc, but every once in a while there'll be a row where the image is named "image63_s.png", "image176_s.png", "image271_s.png", etc. What I'd like to do is create a filter view that will only show rows where the name of the image in the URL ends with "_s".
EDIT: The images are inserted into the sheet with the formula =IMAGE("https://www.example.com/site/image1.png"), so I don't think regex can work here.
use custom formula:
=REGEXMATCH(A1, ".*_s.png$")
update:
=REGEXMATCH(FORMULATEXT(A1), ".*_s.png.*")
or as suggested have a hidden helper column of urls

How to get the reference of a cell based on two filters in Google Sheets?

I am parsing JSON data from a FB Ads Campaign through Graph API in Google Sheets. I have multiple sheets for different ad insights based on a timeframe (today, yesterday, 7 days, 30 days) and a dashboard that shows a snapshot of the most important data like the # of conversions and cost-per-conversion for each campaign.
On the dashboard page, I want to match the Adset ID with the value next to cells that contain 'complete_registration' on an insight page.
This is the current formula I have
=INDIRECT(INDEX("h"&filter(ROW('Todays Insights'!G1:G901),'Todays Insights'!G1:G901="complete_registration")),1)
This works for referencing the first time 'complete registration' is used... but I want the value for each Adset
For example -> IF Column A has Adset_ID and Column B has Complete registration then index value in C
What formula would accomplish this in Google Sheets?
Picture Example
O.K. I think I get it. You want to get 2 coulmns as a result - B and column H when C is registration_complete.
Try:
=filter({'Todays Insights'!a1:a,'Todays Insights'!h1:h},'Todays Insights'!c1:c="complete_registration")
Here is the formula I used that works:
=DGET('Sheet Name'!$A$1:$N$500,"Actions Value",{"Adset ID","Actions Action Type";C24,"lead"})

How to write a query based on the Date item, in interactive grid

I have a date field and a interactive grid. I am trying to generate the Interactive grid based on the value inputted in the date field.
I am trying to write the query as below :
select pap.effective_start_date , pap.effective_end_date
from per_all_people_f pap
where :SELECT_DATE between pap.effective_start_date and
pap.effective_end_date
Here, SELECT_DATE is the name of the Date field (datatype Date picker). I am writing a dynamic action on Change of Date field, and refreshing the interactive grid region.
But when I change the value in Date field, it doesn't return any rows.
I have done a similar change where my interactive grid was based on a dropdown. There I had to set the "page action on selection" to Submit, and it worked. But here, since it is a Date field, the "Page Action on selection" property doesn't appear on the page .
Can somebody please suggest, how can I achieve this.
You need to explicitly convert your bind variables, which are treated as strings, to dates.
to_date(:SELECT_DATE)
The format mask will come from the application properties, or you can be explicit with that, too.

Capture values of a shuttle list

I am using APex 4.2
I have a page (page 31) with a shuttle list. The list contains several job categories (a, e, x, c, etc). I have a button on that page that generates a report based on the selected job category. I click my button, a query runs, and it takes me to a report page (page 27). The query is along these lines
select * from 'table'
where (instr(':'||:P31_JOB_CATEGORY||':',':'||JOB_CATEGORY||':') > 0)
where P31_JOB_CATEGORY is represented by a shuttle list. This gives me the desired results on page 27, however, is there a way to capture each selected job category that was selected in the shuttle list on page 31 and pass it to page 27 to be displayed? It would be nice to have it stored in a concatenated string of some sort for easy handling, i.e. A, E, C, X.
Any help would be greatly appreciated. Thanks in advance.
The reason is in how shuttle values are saved to session state and how the apex URL is constructed.
Shuttle values are constructed, as you have seen, by concatenating the selected values with a colon. So for example, I have a shuttle on ENAME from EMP, select 3 values and submit the page. Session state for the shuttle is: URUGUAY:HOWARD:M BENZ.
Now say that you redirect to another page, setting an item with the value of this shuttle item. The URL will look like this: f?p=54687:6:100741653098795::NO::P6_TEXT:URUGUAY:HOWARD:M BENZ
The apex URL is constructed by using colons. You putting values in there which has colons simply doesn't work for apex.
Solution? You could submit the page and use a computation to replace the colons, and then branch away to the destination page.
For example, with my enames I'm replacing the colon with a ~: URUGUAY~HOWARD~M BENZ. On your destination page you can then use this value and adapt your sql or use a computation in before/after header to replace the seperator again.

Trigger a process (SQL update) when leaving an APEX page

This is a very odd question but i wondered whether it was possible to trigger a process that runs an SQL UPDATE when the user leaves this specific page, either by clicking on the breadcrumb, tabs or back button?
I did setup the process to run on the 'Back' button; however i ran into the problem of: What if s/he clicks on the breadcrumb or a tab instead.
I have searched the net and posting this question was a last resort. I wondered if anyone can point me in the correct direction?
UPDATED POST
Page 1:
Includes a text field and a button. The user enters the category into the text field and clicks on the button to proceed to the next page. The button passes the value in the text field to a text field on Page 2.
Page 2:
Two regions on the page. One region holds information about the category - Category name from the previous page, category description, and the category revision number (which is what i'm trying to get working). The second region is a report that pulls the item name and number that are listed under the category in the category text field. A 'View' link is used on the report to load the edit page for the specific item selected. The 'View' link passes the 'category name' (from the category text field) and the 'item number' from the report to page 3.
Page 3
Two regions are used, first region: Lists the Item number which came from page 2 and name of the item (which i use a simple query to retrieve). In the second region: A report is used with two columns: a list of item properties in column 1, and a text field next to each item property in column 2 to hold the value that can be updated. The 'Apply Changes' button has some PlSql behind which looks for changes and updates where required. It updates the relevant fields that have changed, and it then takes the user back to Page 2 (Page showing user the items listed for the category intitally entered).
I cant increase the category revision on the 'apply changes' button on page 3 because the user may complete edits for items under the same category. So i dont know where i can increase the category revision by 1 per vist to a category. P.s I already increment the revision number for each item by 1 if the info has been changed using the 'apply changes' button on page 3.
One way of doing this is by updating the session state of the page items (without submitting the page as normal) via ajax and by calling an Application Process which updates the table, when called by a javascript onbeforeunload.
Create an Application Process to fire On Demand, named UpdatePageXOnExit or something. In the PL/SQL block of that Application Process, use SQL update commands with the item state of each item on the page that you wish to update; something like the following:
BEGIN
UPDATE table_name SET col1 = :PX_ITEM_1, col2 = :PX_ITEM_2, col3 = :PX_ITEM3, col4 = :PX_ITEM_4, col5 = PX_ITEM_5
WHERE (condition... I would suggest ROWIDs to simplify changes to the
fields of the PK; otherwise you will have to create additional
page items for each field of the PK, then set those items to
the values of the PK when the page loads using a before
header page process, and then use those values in this where
clause like this: where col1 = :PX_ORIGINAL_PK_FIELD_1 AND col2 =
:PX_ORIGINAL_PK_FIELD_2 );
END ;
Go to the page settings for that particular page, and in the JavaScript: Execute On Page Load section, write something like the following:
window.onbeforeunload = updateOnExit;
And in the JavaScript Function and Global Variables Declaration, write something like the following:
function updateOnExit() {
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=UpdatePageXOnExit',&APP_PAGE_ID.);
get.add('PX_ITEM_1',$x('PX_ITEM_1').value)
get.add('PX_ITEM_2',$x('PX_ITEM_2').value)
get.add('PX_ITEM_3',$x('PX_ITEM_3').value)
get.add('PX_ITEM_4',$x('PX_ITEM_4').value)
get.add('PX_ITEM_5',$x('PX_ITEM_5').value)
gReturn = get.get();
get = null;
// Comment out the following line or not, as per the note in the following paragraph
return 'Are you sure you would like to leave the page?';
}
This last piece is the AJAX that updates the session states of the page items on the page that have been changed on the user's end but that haven't been uploaded to the servers end which normally occurs during page submission. Note: If you comment out the return statement, than there will be no warning box that will allow the user to stay on the page. If that is what you prefer, go for it. If you chose to use the warning box, the ajax will execute the page process even if the user chooses to stay on the page.