Skip to content

Instantly share code, notes, and snippets.

@lbrenman
lbrenman / KPIandTotals_Tutorial.md
Created May 24, 2015 16:06
Appcelerator Arrow - KPI and Totals Row Example

Appcelerator Arrow - KPI and Totals Row Example

In addition to being able to easily create integrations to back end data sources, Arrow provides several facilitates for moving data manipulation and processing operations from the client application to the Arrow server. This results in a mobile application that is more highly performant since data manipulations and computations do not need to be performed in the application. Implementing business logic and computations in the server, instead of in the mobile application, makes changes simpler, since a new mobile application does not need to be published when business logic/rules change.

Read more about Arrow here.

###Use Case

@lbrenman
lbrenman / SalesByRegion.js
Created May 23, 2015 21:44
Appcelerator Arrow Totals Row and KPI Calculation using custom field and getter and a block
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.mysql/table1","SalesByRegion",{
"fields": {
"rid": {
"type": "number",
"required": false,
"optional": true,
"readonly": false,
"writeonly": false
@lbrenman
lbrenman / post_markdown.md
Last active August 4, 2016 17:12
Appcelerator Arrow Builder - Multiple Post Blocks Salesforce/Geocode/Foursquare Example

#Appcelerator Arrow Builder - Multiple Post Blocks Salesforce/Geocode/Foursquare Example

In a prior post, I described how Arrow’s Block feature can be leveraged to enhance data retrieved from Salesforce to geocode the data. The sales reps that are using the mobile application are now able to map their accounts as part of their prospecting get turn-by-turn directions without having to copy and paste or manually switching between apps. Many of the sales reps asked if there was a way to see restaurants or coffee shops near the account they are visiting so that when they plan their client visit they can suggest a local coffee shop to meet at. In this blog post, we add on from our last example and add a second block that will take the Salesforce account data that now has geocode information and use the Foursquare API to get coffee shops that are near the Account. This is commonly refferred to as a data mashup. The d

@lbrenman
lbrenman / Account.js
Created May 7, 2015 14:21
Appcelerator Arrow Double Post Block to add GPS coordinates and Local Coffee Shops (via Foursquare) to the Salesforce Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
@lbrenman
lbrenman / Account.js
Last active July 2, 2022 15:28
Appcelerator Arrow Post Block to add GPS coordinates to the Salesforce Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
@lbrenman
lbrenman / AccountDetail.js
Last active August 29, 2015 14:19
Appcelerator Arrow Salesforce Composite Connector Models for retrieving Account Details with Associated Opportunities for that Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","AccountDetail",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
@lbrenman
lbrenman / alert.js
Last active August 29, 2015 14:17
ArrowDB Custom APIs Example - Sample custom api's in the apis folder interacting with the same model as the automatic APIs
var Arrow = require('arrow');
var ACS = require('acs-node');
ACS.init(<ACS Key>);
var Alert = Arrow.API.extend({
group: 'iotapis',
path: '/api/alert',
method: 'GET',
description: 'this is an api that shows how to implement an API',
@lbrenman
lbrenman / app.js
Last active August 29, 2015 14:17
ArrowDB Block Example - Sample 'Before' Block to be executed before each API call related to the iotdevice model - clear iot device timer
var Arrow = require('arrow'),
server = new Arrow();
var Timers = require('./timers');
// lifecycle examples
server.on('starting', function(){
server.logger.debug('server is starting!');
});
server.on('started', function(){
@lbrenman
lbrenman / ACS.js
Last active January 18, 2017 13:46
Appcelerator Titanium, Appcelerator mBaaS, Raspberry Pi - Full Stack JavaScript iOT Example to use mobile app to control RPi through mBaaS
var Cloud = require('ti.cloud');
exports.ACSLogin = function(u,p,o){
Ti.API.debug("ACS: ACSLogin()");
if(Titanium.Network.networkType == Titanium.Network.NETWORK_NONE){
alert("No Network. Please try again later.");
if (o.error) { o.error("ACSLogin(): No Network"); };
return;
}
@lbrenman
lbrenman / app.js
Created March 4, 2015 16:29
Overcoming Cross Site Scripting issue with Node Apps
// initialize app
function start(app, express) {
app.use(express.favicon(__dirname + '/public/images/favicon.ico')); //set favicon
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-requested-with, X-Titanium-Id');
res.header('Access-Control-Allow-Credentials', 'true');
next();