Simplication of Java Script

Avatar

Avatar

aka44356106

Avatar

aka44356106

aka44356106

08-09-2019

in a livecycle dynamic form use this java script

if

   (Table92.Row1.Cell1.rawValue !== null && Table92.Row1.Cell2.rawValue !== null)

   {

          this.rawValue = "Completion of construction work for the " + Table92.Row1.Cell1.rawValue + " phase of instalment and request for release of " + Table92.Row1.Cell2.rawValue + " phase of instalment";

   }

if

   (Table92.Row1.Cell1.rawValue !== null && Table92.Row1.Cell2.rawValue == null)

   {

          this.rawValue = "Completion of construction work for the " + Table92.Row1.Cell1.rawValue + " phase of instalment and request for release of .................... phase of instalment";

   }

if

   (SfCC.Table89.Row5.Table92.Row1.Cell1.rawValue == null && SfCC.Table89.Row5.Table92.Row1.Cell2.rawValue !== null)

   {

          this.rawValue = "Completion of construction work for the .......................... phase of instalment and request for release of " + SfCC.Table89.Row5.Table92.Row1.Cell2.rawValue + " phase of instalment";

   }

if

   (SfCC.Table89.Row5.Table92.Row1.Cell1.rawValue == null && SfCC.Table89.Row5.Table92.Row1.Cell2.rawValue == null)

   {

          this.rawValue = "Completion of construction work for the .......................... phase of instalment and request for release of ................... phase of instalment";

   }

Please help me to short the java script ( i have very limited knowledge of java script)

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

radzmar

MVP

Total Posts

2.6K

Likes

387

Correct Answer

485

Avatar

radzmar

MVP

Total Posts

2.6K

Likes

387

Correct Answer

485
radzmar
MVP

08-09-2019

You can minimize it this way:

var oCell1 = Table92.Row1.Cell1,

oCell2 = Table92.Row1.Cell2,

cTxt = "Completion of construction work for the ";

if (oCell1.isNull) {

cTxt += oCell2.isNull ? (".......................... phase of instalment and request for release of ................... phase of instalment") : (".......................... phase of instalment and request for release of " + oCell2.rawValue + " phase of instalment");

} else {

cTxt += oCell2.isNull ? (oCell1.rawValue + " phase of instalment and request for release of .................... phase of instalment") : (oCell1.rawValue + " phase of instalment and request for release of " + oCell2.rawValue + " phase of instalment");

}

this.rawValue = cTxt;

or even more

var oCell1 = Table92.Row1.Cell1,

oCell2 = Table92.Row1.Cell2,

cTxt = "Completion of construction work for the ",

cDummy = "...................",

cTxt2 = " phase of instalment and request for release of ",

cTxt3 = " phase of instalment.";

if (oCell1.isNull) {

cTxt += oCell2.isNull ? (cDummy + cTxt2 + cDummy + cTxt3) : (cDummy + cTxt2 + oCell2.rawValue + cTxt3);

} else {

cTxt += oCell2.isNull ? (oCell1.rawValue + cTxt2 + cDummy + cTxt3) : (oCell1.rawValue + cTxt2 + oCell2.rawValue + Text3);

}

this.rawValue = cTxt;

Answers (2)

Answers (2)

Avatar

Avatar

aka44356106

Avatar

aka44356106

aka44356106

09-09-2019

Sir

please suggest something so that font of Table92.Row1.Cell2 & Table92.Row1.Cell2 will also copy after calculation in script.

Avatar

Avatar

aka44356106

Avatar

aka44356106

aka44356106

08-09-2019

thank you very much.

Its working..............