Display value form rows marked in spotfire visualization? - javascript

After marking in a visualization i want to capture a particular column value form rows marked and display it in text area .
thanks

The way to do this is to add a data function to the analysis. Define the function as a identity function, i.e.:
output <- input
This can be an R function or TERR function. If you use TERR it can execute locally rather than going to stat services (though web player will need to use stat services anyway).
Now, connect the data function to your analysis and as input you make it depend on the current marking. Assign a value to the input parameter by creating an aggregation on the column with the value you are looking to collect.
Assign the output of the data function to a document property.
The image linked here shows a sample of how to configure the input parameter:
Sample input parameter config
To show the result in the text area you create a normal property control of your choice in the text area, and attach it to the document property that is written to by the R/TERR script.

Related

How to access an entered Interactive Grid column value in a Javascript dynamic action on the Change event in order to ensure uniqueness

I am trying to prevent duplicate items from being entered in an Interactive Grid in Oracle Apex 20.2. I do get a unique constraint error when this happens, but this is for a barcode scanning stock control app and the unique constraint error only happens when saving after scanning a room with lots of objects. It is then very difficult to find the duplicate field. You also cannot use sort, since that wants to refresh the page and looses all your scanned items. I cannot presort because I want the last scanned item on top.
I was able to add Javascript on page load that creates an array with all the barcodes. I then check this array when scanning and do not add new Interactive Grid rows when a duplicate barcode is going to be added to the array.
In addition to this I need to add the same for when an Interactive Grid row is manually entered. For this I wanted to add a Javascript dynamic action on the barcode column in the Interactive Grid, in order to once again check the global array for uniqueness. However I have several issues: I cannot figure out how the get the entered barcode value in the change dynamic action Javascript, sometimes it shows the previous changed value (might be this bug although I am in 20.2) and the Change event also seems to fire twice when hitting enter after entering a value (once for the new row (this time my code works unlike when hitting Tab) and once for the next row below). The last one seems bad, since then it will try to check existing values (the next row) and give errors that should not happen; however I do not see a more appropriate event like On Row Submit. Not sure if there is a way to check whether the value changed on the Change event.
The code I currently have I got from here. I am assuming this means Oracle Apex does not have a standard way of getting an Interactive Grid column value in a Javascript dynamic action. Not sure if this has changed in 20.2 or 21. The code I have is:
console.log($(this.triggeringElement));
var grid = apex.region('LINES').widget().interactiveGrid('getViews', 'grid');
var model = grid.model;
var selectedRow = grid.view$.grid('getSelection');
var id = $(selectedRow[0][0]).data('id');
var record = model.getRecord(id);
let bcode = model.getValue(record, 'BARCODE');
console.log(id);
console.log(record);
console.log($(selectedRow[0][0]));
console.log(bcode);
if(barcodes.includes(bcode)) {
apex.message.showErrors([{
type: "error",
location: "page",
message: "The entered barcode is already in the list.",
unsafe: false
}]);
}
When I console.log(record) I can see values that I enter into the barcode column, but I do not know how to walk the object tree in order to retrieve the value out of the record. I do not understand the object it shows me in the console log. It does not seem to correlate with the dot access traversals that others are doing in the above code. I can see the record array at the top, but for that the barcode column shows the previous value; below that it does however show the newly entered value as the third (2) index, but I do not know how to write Javascript to access that.
If I can access the previous and new value from the record object I could check for changes and also compare the new value against the global array. How do I access these values in the record object or is there a better way of achieving my goal? bcode prints the previous value, so I guess I already have that if that is not a bug.

Custom Google Sheet Function Updating Without Any Cause

I'm using a custom function to pull price data for EVE Online and I would only like the function to update upon a specific cell change. Instead it's updating every ~10-20 minutes which is using up a ton of my daily quota for URL Fetches.
Looking below you can see the main function is in a page labeled "Warehouse Stock". It pulls all price data for items in the "Item" column. The cell refreshes with a custom function that changes cell B4 in the utility sheet. When that cell changes it updates the values in the custom function because of the IF/THEN statement. Lastly the prices are loaded into the main sheet and sorted by the "product" column.
Also I have recalculation "On Change" and Iterative Calculation turned off.
Thank you for reading and any help you can provide.
The custom function is:
/**
* Query's Fuzz market API for the given types
* #param {range} A vertical range of type_ids.
* #return maxBuy and minSell for each type_id
* #customfunction
*/
function fuzzApiPriceData(type_ids) {
if (!type_ids) throw 'type_ids is required';
const ids = Array.isArray(type_ids) ? type_ids.map(id => id[0]) : [type_ids];
const fuzz_price_data = JSON.parse(UrlFetchApp.fetch(`https://market.fuzzwork.co.uk/aggregates/?station=60008494&types=${ids.join(',')}`));
return [['minSell', 'maxBuy']].concat(type_ids.map(type_id => [parseFloat(fuzz_price_data[type_id]['sell']['min']), parseFloat(fuzz_price_data[type_id]['buy']['max'])]));
}
i think there's a fairly basic misunderstanding here.
"Custom functions" are designed to be written in cells on a sheet. they are by there nature designed to run ALL the time, constantly updating.
If you are attempting to run a custom script, you do that from the script editor itself, you don't even write the function in a cell at ALL.
I'm assuming you didn't write the "custom function" you're using(?) So it will be a bit difficult (but not impossible!) to convert it to a script that writes to a certain place on the sheet at a certain time. But you might research a bit more about the difference between custom functions designed to be executed in cells, and scripts designed to be run on a time trigger.
Regarding you answer:
I would like the function to refresh everyday, aswell as having the option to manually refresh the function by the contents of the cell Utility!B4
I propose you to use Installable Triggers:
Time-driven trigger: It can execute a function each day at specific time.
Installable edit trigger: It can execute a function when a certain value in a specific cell changes.
However, if you want to execute a function manually, I recommend you to insert a drawing and assign a function to it.
Reference
Installable Triggers
Clickable images and drawings in Google Sheets
What I usually do for that is : put a checkbox in a cell. Then, when calling your custom function, add an extra reference to that cell, even if the parameter is not included in your custom function. Each time you will switch true/false, your custom function will be reactivated. Then you can also define another function with a trigger that just change the value of true/false. Here is an example in sheet 'Data' cell A3 : the function is getDataJSON(C1,A2:U2,A1) with A1 even if the custom function take into account only the first and second parameter. https://docs.google.com/spreadsheets/d/1DN0Gfim0LC098zVgrUpt2crPWUn4pWfZnCpuuL1ZiMs/edit?usp=sharing

How to extract report based calculation from BRIO report?

How to extract report based calculation from BRIO report ?
For example Multiple Requests
is there public API available to do this task?
Enter code to remove the fields you want to hide from the Results section after the query
finishes processing. For example:
// Eliminate fields from the drill path
ActiveDocument.Sections["Results"].Columns["State"].Remove()
ActiveDocument.Sections["Results"].Columns["Date Ordered"].Remove()
5) Now select the OnPreProcess event and enter code to put the fields back into the Results
section just before processing the query. That way, any dependent computed items will be
properly refreshed. The corresponding code for the current example would be:
// Add the "hidden" fields so computed items can be recalced
ActiveDocument.Sections["Results"].Columns.Add("Date Ordered")
ActiveDocument.Sections["Results"].Columns.Add("State")
Got the API which can add/remove the calculated items but unable to retrive the existing column formula for the computed items, Is there any API even to retreive the column formula
If you are you trying to get the code if(Count ( Account_Id, Account_Id)>1) {'Multiple Requests'} there is an EIS (Dashboard) code ModifyComputed() that allows you to see it as a string: https://docs.oracle.com/cd/E17236_01/epm.1112/ir_user/ModifyComputed_meth.html
If you have no clue what the original code was, I don't think you can extract it, though.

How to add dynamic dropdown values in jQgrid?

In the editOptions for select dropdown we pass some static values after the instantiate of the grid_data. Everything works fine until we choose editing. As the data remains constant and static.
All the dropdown remains same. But this should not happen, it has to load the appropriate data to the rows which should be dynamic.
var data = {
"id" : "cityGrid",
"grid_data" : response,
"colNames" : ['City Name','Select State','local'],
"colModel": [
{"name":'cityName',"index":'cityName', "width":150,"editable": true,"editoptions":{"size":"20","maxlength":"30"}},
{"name":'selectState',"index":'selectState',"width":90,"editable": true,"edittype":"select","editoptions":{"value":"TN:Tamilnadu;AP:Andhrapradesh;MP:MAdhyapradesh",
"class":"chosen-select","width":200,"custom":true,"custom_func":util.applyChosen}},
{"name":'local',"index":'local', "width":70, "editable": true,"edittype":"checkbox","editoptions": {"value":"Yes:No"},"unformat": "aceSwitch"}
],
"editurl": "/dummy.html",
"caption": "City Information"
};
"editoptions":{"value":"TN:Tamilnadu;AP:Andhrapradesh;MP:MAdhyapradesh"
I also came across dataUrl passing after few search results. But it was not upto the mark as i need to send a param with it which is not possible there.
And even thought of taking the value of one particular row data and make it select on top and load rest of with static as i use the chosen form of data which triggers on keypress and my problem would get solve. The problem here is with editing with two types one with single row and multirow.
This is a phase where i got struck. Has anybody solved this problem. Any new version of jQgrid has a answer to this problem?
Thanks in advance
First of all you do can generate dataUrl dynamically based. The easiest way would be to define dataUrl as callback function: dataUrl: function (rowid, value, name) { ... }.
On the other side it seems that you need to generate select with <option> where value is not the same as the displayed text: <option value="TN">Tamilnadu</option>. In the case the value TN will be saved in the column after editing and so you should probably hold (to fill) the corresponding column with data like TN, AP, MP instead of Tamilnadu, Andhrapradesh, MAdhyapradesh. You should use formatter: "select" (see here) to display input values TN, AP, MP like Tamilnadu, Andhrapradesh, MAdhyapradesh. The formatter formatter: "select" uses formatoptions.value or (it it's not defined) the editoptions.value value. So one have to be able to set editoptions.value (or formatoptions.value or both) before the grid content will be created, so before the server response will be processed by jqGrid.
To be able to set the editoptions.value dynamically one can use setColProp method. If you loads the data from the server one can include all column property with exception name property in the server response. One can do this inside of beforeProcessing callback for example. The answer this one and this one describe the approach detailed. The answer shows how one can use common column name property ("c1", "c2", "c2") and uses jsonmap to read the relatively common named data. One can set jsonmap instead of name property if it's needed.

Populating a drop down based on a text field Javascript/Coldfusion 8

I have a page that has around 30 different entry fields, one of the top fields is a textfield and after this is filled in, I want to populate a dropdown and a textfield. I currently have it calling a javascript function, however my main problem is that I need to query the database to find out what value to populate the fields with.
Here is the type of thing I was trying to do:
function populateState(){
<cfquery name="getState" datasource="#application.dsn#">
SELECT STATE_CODE, CODE_ID
FROM LERG_LATA_V1 LEFT OUTER JOIN Code ON STATE_CODE = CHAR1_TX
WHERE NPX = #NPANXX#
</cfquery>
}
And then after that I would need to read the result and select that element. Any suggestions on how to do this? Most of what I am finding on my google searches are saying you cannot mix cf and js since they execute at different times.
You need to either create a state JavaScript array with your query, and then reference that in your javascript, or use the built-in cfselect tag binding to make this happen. Here's a simple example of how I do this:
http://www.dansshorts.com/post/cfselect-binding-and-selectedvalues
Dan

Categories