Jump to content

chob1234

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About chob1234

  • Rank
    Newbie
  1. chob1234

    Rounding

    Confused on why my toFixed(2) function is not rounding my output. Located at the bottom of my code here. My output is "501327.3600770543" //// Get the sq inch. for BuildIDs that start with AA and //// sets value to the "result" variable var result=0; var params = { maxItems: 100000 /* NUMBER */ }; //// result: INFOTABLE var itPartInfo = Things["Training.InfoTable.PartInfo"].GetDataTableEntries(params); // Return square inches of Oak needed for each build ID that starts with AA // Like type filters by a like criteria // filters rows from Infotable PartInfo var query = { filters: {
  2. Yeah I think you are right on that, I believe the only way as of now in the thingworx platform to remove undesired columns is the .removeField("field") function, which you would have to have a function for every single column which is very inconvenient.
  3. Sorry not errors, it is returning all of the information for input partID, I thought that the sort function would return just the Color of that partID, which it is not.
  4. var params = { maxItems: 100000 /* NUMBER */ }; //// result: INFOTABLE var itPartInfo = Things["Training.InfoTable.PartInfo"].GetDataTableEntries(params); ///***************************************** // ADD YOUR CODE BELOW //*****************************************/ var query = { "filters": { "fieldName": "ID", "type": "EQ", "value": partID } //partID is an input }; var idQuery = { t: itPartInfo /* INFOTABLE */, query: query /* QUERY */ }; //// result: INFOTABLE var result = Resources["InfoTableFunctions"].Query(idQuery); So this code will return an item in an
  5. Got it all working now, thanks!
  6. Yeah I am not sure exactly, I guess the goal is to convert the string input to an int, but confused.
  7. So I came up with this: function isNumeric(string) { return !isNaN(parseInt(string)) && isFinite(string); } if(isNumeric(parseInt <= 10000)) { //You have a number logger.debug("You have a number") } else { //You don't have a number logger.debug("This cannot be a number") } It only outputs "This cannot be a number" What am I doing wrong? I am logging in Thingworx so that is where the logger.debug is coming from.
  8. I am needing to convert an String input into an Integer. But before converting the String input, i have to do a validation that the String input can be converted to a numeric value. So If it cannot, i need to log a message saying “This cannot”. Then log another new log statement on the next line saying “be a number”. I understand I need a parseInt and isNan and if else statements but I am confused on exactly how they are implemented. I am new to javascript.
×
×
  • Create New...