Code by Zapier - Input data field losing information when trying to execute code - zapier

I am using code by zapier, javascript.
I've used before and never had problems.
But today, as I am trying to create a new zap, I am reading data from trello and then trying to process the data with code by zapier.
I am filling data coming from trello in the field "Input Data", and then, trying to read the input data in my code using:
var cards = inputData['cards'].split(",");
The problem is that when I test the code, I receive an error:
TypeError: Cannot read property 'split' of undefined
When I go to check the Input Data field, it is losing the information.
Even if I type again, the Input Data information is not storing what I am asking there.
Any ideas?
Thank you
Amanda

Thank you everyone. I haven’t changed a thing.
I’ve tried in the next day with the same zap and that initial code that I posted.
Zapier was cleaning out the field with the data input from Trello (wasn’t detaining the value to pass to the next step).
Now it’s working. As I tried with different browsers on the same day and it was equally not working, I believe it was a bug that was fixed.

Related

Print Core Data Results To New Controller and Send To Email

* Edit * So my last question is, how to I get the data shown to be sent in email. I have done much HTML email in my other apps, but am confused as to what I am asking to look for / reference from core data and the proper formatting of code...
Using core date to populate UITable... all good... works as planned... (see pic 1) question... how can I get the result to format and and perhaps display as a UILabel on another controller similar to other results (see pic 2)... and then part two of my question... How can I get that result to print nicely in an email... I have used other code (not from coredata) to print and all works nicely together... I am stumped by the coredata portion...
In the result, you can see the math works out from core data, just don't know how to capture what the user typed in from core data (see pic 3)
Any help greatly appreciated...
EDIT (Clarification)...
I guess I want to show what the user has input into a new view controller and have it displayed in a readable format... (see image)...
Maybe my question is more... how to I PASS the data THAT THE USER CREATED from the Core Data Table Model to a new view controller and display the incoming text as a UILabel? (Can the new view controller be updated automatically? The user may add a new row, delete a row, change the hourly rate on an existing row, change a label etc. etc.. Once that is solved, I'd like to know how to send the results in an email so the end user can print for hard copy documentation... I have this scenario working in other apps, but they do not use core data...

cumulocity mqtt measurement

I am pretty new to Cumulocity and I am trying to get data into the platform from my own device using mqtt and the smartrest templates. I can get data in using the static templates but they only support certain data types. I am struggling to create the appropriate smartrest template in the UI and the documentation doesn't go into much detail.
I get that the template name goes in the MQTT topic (or selected on login as part of the username) in s/ut/template_name and the messageId of the messages in the template get matched to the first CSV field of the MQTT publish payload. What I don't get is the template terminology. In the UI I choose API->Measurement and Method->POST and I am presented with required values $.type and $.time. My questions:
Is $.type the "measurement fragment type" name or do I have to make it "c8y_CustomMeasurement"? Can I call it whatever I want?
$.time has a value field. Is this the default value if one is not supplied in the publish?
I assume I need to add a numerical value in the optional API values. To link it to the value of the data point should I make the key "c8y_CustomMeasurement.custom.value"?
Am I way off base here?
Every time I publish to my own smartrest template the server drops the connection so I assume its an error in my template setup but I don't see a way of accessing debug messages (also nothing is published back to me on s/e or s/dt).
For the sake of an example, lets say I wish to publish a unitless, timestamped pulse count with payload format "mId,ts,value" with example data "p01,'2017-07-17 12:34:00',1234"
What you wrote so far is mostly correct just to be a bit more precise:
The topic is s/uc/template_id (not the template name, this is just a label)
The $.type refers to the 'type' fragment in the measurement JSON. It is a free text field
In 99% of cases you want to leave the $.time empty. If you set something here it is not the default but fixed to that timestamp and you cannot change it when using the template. If you leave it empty and still not send something in
Example: p01,2017-07-17T12:34:00,1234 (no quotes arounf timestamp and ISO8601 format
Example without sending time: p01,,1234 (sending empty string as time results in server time beeing set. The template is the same)
Hope these points help you to find you issue

Bringing in a google form response to a sheet

Here is a copy of the sheets and form (form > go to live)
https://docs.google.com/a/ncsu.edu/spreadsheets/d/1mEz9mLEgP4Cfts2ZU6NwhNiL6xjWdFbt42RUj-RYbZw/edit?usp=sharing
So currently, I get responses in a different sheet. Ideally, I would get the response on the tracking sheet with the appropriate format for the dates. Additionally, I would like to keep the functionality of the tracking sheet which is to be able add in items by hand and not through the form. I currently have a script in place which auto-inputs the current date as the two separate formats.
So I'm looking for a solution which either takes in form response to the sheet and appropriate cells (the first empty cell). Or I'm looking to create a script which onEdit which when the form sheet is edited, will fetch the new response and copy it over appropriately onto the tacking sheet.
I have tried googling answers.. But I think I may be a failure at it since I wasn't able to really find a solution for this particular problem. Thank you in advance for the help!
form:
https://docs.google.com/forms/d/1AHSQrLkq3U7NJMvgWoH3lAygova7Mi4BaXHdROaaS2g/edit?usp=sharing
The script associated to this form should do the trick.
All the explanations on how to use it are in the response sheet

Split datetime value received from external API in Rails app

I have a datetime value which comes from the API in this format: 2015-07-07T17:30:00+00:00. I simply want to split it up between the date and time values at this point. I am not using an Active Record model and I prefer not to use an sql database if I can.
The way I have set up the app means that the value is "stored" like this in my view: #search.dining_date_and_time
I have tried two approaches to solving this problem:
Manually based on this previous stackoverflow question from 2012: Using multiple input fields for one attribute - but the error I get is the attribute is "nil" even though I put a "try"
Using this gem, https://github.com/ccallebs/split_date_time which is a bit more recent and seems to be a more elegant solution, but after closely following the doc, I get this error, saying my Search model is not initalized and there is no method: undefined method dining_date' for #<Search not initialized>
This is when instead I put #search.dining_date in the view, which seems to be the equivalent of the doc's example (its not that clear). The doc also says the method will be automatically generated.
Do I need to alter my model so I receive the data from the API in another way? ie. not get the variable back as #search.dining_date_and_time from the Search model for any of this to work?
Do I need an Active Record model so that before_filter or before_save logic works - so i can (re)concatenate after splitting so the data is sent back to the API in a format it understands. Can I avoid this - it seems a bit of overkill to restructure the whole app and put in a full database just so I can split and join date/time as needed.
Happy to provide further details, code snippets if required.
As I am not using a conventional Rails DB like MySql Lite or Postgresql, I found that the best solution to the problem was by using this jQuery date Format plugin: https://github.com/phstc/jquery-dateFormat to split the date and time values for display when I get the data back from the API.
The Github docs were not too expansive, but once I put the simply put the library file in my Rails javascript assets folder, I just had to write a few lines of jQuery to get the result and format I wanted:
$(function() {
var rawDateTime = $('#searchDiningDateTime').html();
// console.log(rawDateTime);
var cleanDate = $.format.date(rawDateTime, "ddd, dd/MM/yyyy");
// console.log(cleanDate);
$('#searchDiningDateTime').html(cleanDate);
var cleanTime = $.format.date(rawDateTime, "HH:mm");
// console.log(cleanTime);
$('#searchTime').html(cleanTime);
});
Next challenge: rejoin the values on submit, so the API can read the data by sending/receiving a valid request/response. (The values can't be split like this when sent to the remote service).

Rails validation fails but object memory remains unchanged?

First time user long time reader. I have thoroughly looked for an explanation for the problem I'm having via the mighty search engine Google, but alas I have failed to produce any significant insight.
I need to be able to ensure that a model form is not reloaded with invalid data. Since the model stored in memory on the server is edited directly with the parameters of the web form first, and THEN checked for validity, without additional code invalid model data will ALWAYS be sent back to the form. This is less than desirable to me. My question is this: how do I ensure this doesn't happen?
What I'm thinking is I need some mechanism for saving the state of the object before it's modified with the parameters sent from the web form, and then after a failed validation restore the object to it's previous, correct and unmodified state of being.
Help!
Thanks,
Les
The object isn't actually modified in the db if validation fails, even though the object is in an invalid state in the form ... the thinking behind this is that the user wants to see the errors they made so they can correct them.
If you don't want that to be the case, then just read back the object with a WhateverObject.find(x) and assign it to the variable that the form is referencing and it will 'restore' the object to its previous unmodified state.
To add to what concept47 said you can also get the value for a particular field using
object.field_was
Have a look at ActiveRecord::Dirty for details (http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.html)
Using that you could retrieve the original values for just those fields that had validation errors.

Resources