I am trying to visualize field data but based on the first 3 characters within the string. Say the field contains "+44123456", I want the pie chart to visualize based on "+44" only.
Please assist me in achieving this with advanced JSON field ?
You can do it via using the "Advanced JSON" input field :
Try following script :
{
"script": "( _value.indexOf(' ') > 0 ? _value.substring(_value.lastIndexOf(' ')) : _value )"
}
Related
I have a problem where I have a list of fields from a table (not static, can be modified by user), and I need to generate a report using these user selected fields. The report can show all the rows, no need for aggregation or filtering.
I thought I could create a report layout then using a filemaker script to populate it but can't seem to find the right commands, can someone let me know how I could achieve this?
I'm using filemaker pro 18 advanced
Thanks in advance!
EDIT: Since you want a dynamic report, then I recommend you look up a technique called "Virtual List" for rendering the data.
Here's an example script that iterates over a found set of records and builds the virtual list data in a variable (it doesn't show how to render it though):
# Field names and delimiter
Set Variable [ $delim ; Value: Char(9) // tab character ]
# Set these dynamically with a script parameter
Set Variable [ $fields ; Value: List ( "Contacts::nameFirst" ; "Contacts::nameCompany" ; "Contacts::nameLast" ) ]
Set Variable [ $fieldCount ; Value: ValueCount ( $fields ) ]
Go to Layout [ “Contacts” (Contacts) ; Animation: None ]
Show All Records
Go to Record/Request/Page [ First ]
# Loop over all the records and append a row in the $data variable for each
Set Variable [ $data ; Value: "" ]
Loop
# Get the delimited field values
Set Variable [ $i ; Value: 0 ]
Set Variable [ $row ; Value: "" ]
Loop
Exit Loop If [ Let ( $i = $i + 1 ; $i > $fieldCount ) ]
Set Variable [ $value ; Value: GetField ( GetValue ( $fields ; $i ) ) ]
Insert Calculated Result [ Target: $row ; If ( $i > 1 ; $delim ) & $value ]
End Loop
enter code here
# Append the new row of data to the list variable
Insert Calculated Result [ Target: $data ; If ( Get ( RecordNumber ) > 1 ; ¶ ) & $row ]
Go to Record/Request/Page [ Next ; Exit after last: On ]
End Loop
# Save to a global variable to show in a virtual list layout
Set Variable [ $$DATA ; Value: $data ]
Exit Script [ Text Result: ]
please note this code is just one of many possible formats the virtual list can take. A lot of people, myself included, prefer to use JSON objects or arrays for each row of the list since it automatically handle field values with carriage returns. This is sort of the old-fashioned way. Kevin Frank at FileMaker Hacks has some good recent articles about virtual list techniques if you're interested.
PS, another great technique for rendering table data dynamically is to collect the data in a JSON array and render it in a webviewer with https://datatables.net/
I did something like this for the oncology department of UM om 1980 or so using 4th Dimension and a new plug in that used one line of code to create a web browser with all the functions that a doctor might want. The data was placed inside a variable as it was sent/returned and 4D could use a variable in the report to display the data.
FileMaker does not have this ability built in as 4D did so you will have to do it yourself.JSON is the most likely tool that I am familiar with. YouTube has many videos on JSON.
You have two classes of variables for your report: Column headers and column data to display. Fortunately Filemaker is quite good and very easy to design. Just make a typical report and replace the text/header or field names with a JSON variable or any. $ColumnName = JSON variable.
Create a JSON calculated field in the database. In that calculated field set the JSON variable and this can be used for all of the columns.
This is the essence of the idea with the final result to be determined by you. What you are asking for is not easy and would require serious work by a skilled JSON scripter.
In icCube reporting tool 6.1
is there a possibility to retrieve data like a cellValue(rowindex,columnindex) while i'm in a diffrent widget like chart box for example and wanna get a cell value from different table in the report? with Widget's JavaScript...? and also do other functions like column count or row count as i'm in the Widget's JavaScript of the actual table...?
UPDATED QUESTION
Example:
i wanna be able for example to get in the chart palette by Expression to
retrieve the number of the 1 row and column 2 (value 12)
and then for the example i wanna use this number and see if the number is greater then 10 then i will want the chart color to be Green and if less the blue... so i wanna know how to retrieve a specific cell from the table when the chart loads... and the chart will wait for a click on row from the table
so it will load after the table... so the rendering problem you've mentioned you have won't be a problem here.
You can share Table's data with global variable.
In On Data Received hook:
/**
* Return data object
*/
function(context, data, $box) {
window.ic3Data = {};
window.ic3Data.tableContext = context;
return data;
}
Then you can easily use PublicTableContext API from table widget in other charts. For example in a coloring expression for an AmChart:
return window.ic3Data.tableContext.cellValue(0,1) > 10 ? 'green' : 'red';
I have apache logs with size of each request and the time , I need to plot graph on amount of data transfered per unit time.
A sample document looks like below
{
"#timestamp" : "2015-01-01T00:00:00",
"bytes" : 20
}
For each minute , I want to take sum of the bytes field and plot that over a graph in Kibana 3. Can anybody help me on this?
This can be done by editing the panel settings,as shown in the figure below:
"Values" dropdown: Select the value to be "total" from this.
Values Field : The field which is to be analysed. Here in your case it is "values"
"Time Field" : the timefield in your data,ie "#timestamp"
"interval" : set as "1m" here.
You should be able to do this using a histogram panel.
Under values, set 'chart value' to 'total' and use bytes as the value field
Check that 'time field' is #timestamp
Untick auto-interval and set the interval to be '1m'
I have a crosstab where one of the groups contains a date. When the date is NULL, i want to display a space, anything I've tried including the code below on the expression for the binding name of the field. Yet it still displays Jan 1, 0001. How can I get it to display a space instead when the value is NULL?
if (["Group5"]["CP_EXPIRATION_DATE"] == null ) {
" ";
} else {
dimension["Group5"]["CP_EXPIRATION_DATE"];
}
I am not sure you can do this in the binding expression because the datatype is a Date, therefore a blank space can't be set as value. You could always use a script for this, although there might be a more elegant way:
Click your expiration date field onto the crosstab-> Script tab -> onRender -> Enter a script such
if (dimension["Group5"]["CP_EXPIRATION_DATE"]==null){
this.setDisplayValue(" ")
}
1-How do I set the column to be sorted when the grid is created? then upon reloading the grid, it automatically utilize that sort to appropriately display the records.(without me clicing on it)
Can this be done on the grid itself so it is independent of the underlying data store?
2-how do i change Date format displaying in a grid column?
my data render a date like this /Date(1316020760837+0000)/
i tried using renderer: Ext.util.Format.dateRenderer('m/d/Y'),// format: 'm d Y'
but it gives me NaN/NaN/NaN
any help would be appreciated.
thank you
solved:
i used sortOnLoad with sorters
var myStore = new Ext.data.JsonStore({
fields: ['Item1', 'Item2', 'Item3', 'Item4']
, data: []
, sortOnLoad: true
, sorters: { property: 'Item1', direction : 'DESC' }
});
in my c# code i used item.DateEnd.ToString("MMM dd, yyyy").
see this or this for standard and custom format
or better
in extjs4 ,you should specify the dateFormat so Ext can parse it properly and you'll ensure it gets read ok.
{name: 'Item1' , type : 'date',dateFormat :'MS'}
u can see this for available format strings.