• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with Javascript

New Here ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

So I have 2 sets of Javascript that work fine seperately to populate into my specified text box but I cannot figure out how to make them both populate to the same text box. Help please!! 

 

Here is the 1st set of script:

// Get the field values, as strings

var s1 = "Temp: " + getField("Temp").valueAsString;

var s2 = "Rt BP: " + getField("BPright").valueAsString;

var s3 = "Lt BP: " + getField("BPleft").valueAsString;

var s4 = "Oxi: " + getField("Oxi").valueAsString;

var s5 = "Pulse: " + getField("Pulse").valueAsString;

var s6 = "Resp: " + getField("Resp").valueAsString;

var s7 = "Chest Exp: " + getField("Chest Exp").valueAsString;

 

// Combine values, separated by a semicolon

event.value = s1 + ";" + " " + s2 + ";" + " " + s3 + ";" + " " + s4 + ";" + " " + s5 + ";" + " " + s6 + ";" + " " + s7;

 

Here is the 2nd set: 

var values = [];
for (var i=41; i<=46; i++) {
var fname = "Checkbox "+i;
var f = this.getField(fname);
if (f==null) {
console.println("Error! Can't find: " + fname);
continue;
}
if (f.valueAsString!="Off") values.push(f.valueAsString);
}
if (this.getField("Vision Findings").valueAsString!="") values.push("Vis Find: " + this.getField("Vision Findings").valueAsString);
event.value = values.join(", ");

 

TOPICS
JavaScript

Views

249

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Want you the text of the second script after the text of the first script?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Yes please

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

LATEST

At the end replace

event.value = values.join(", ");

with

event.value += " " + values.join(", ");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines