JavaScript code faster or shorter

Avatar

Avatar

Anto_bt

Avatar

Anto_bt

Anto_bt

20-12-2016

I am making calendar for 2017, and I have this code to write the nr. of task in each day that is the task. So I have 12 codes like this and they so slow. I need to wait 5 min, until they are finished.

This code down it is just for first day for January. And I have for all days.

Can you help me?

var J31 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[30].JDN31")

var J30 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[29].JDN30")

var J29 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[28].JDN29")

var J28 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[27].JDN28")

var J27 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[26].JDN27")

var J26 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[25].JDN26")

var J25 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[24].JDN25")

var J24 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[23].JDN24")

var J23 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[22].JDN23")

var J22 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[21].JDN22")

var J21 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[20].JDN21")

var J20 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[19].JDN20")

var J19 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[18].JDN19")

var J18 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[17].JDN18")

var J17 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[16].JDN17")

var J16 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[15].JDN16")

var J15 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[14].JDN15")

var J14 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[13].JDN14")

var J13 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[12].JDN13")

var J12 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[11].JDN12")

var J11 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[10].JDN11")

var J10 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[9].JDN10")

var J9 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[8].JDN9")

var J8 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[7].JDN8")

var J7 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[6].JDN7")

var J6 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[5].JDN6")

var J5 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[4].JDN5")

var J4 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[3].JDN4")

var J3 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[2].JDN3")

var J2 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1[1].JDN2")

var J1 = xfa.resolveNode("Page1.#subform.Januar.Table1.Row1.JDN1")

var task1 = "", task2 = "" , task3 = "" , task4 = "" , task5 = "" , task6 = "" , task7 = "" , task8 = "" , task9 = "" , task10 = "" , task11 = "" ,

task12 = "", task13 = "" , task14 = "" , task15 = "", task16 = "", task17 = "", task18 = "", task19 = "", task20 = "", task21 = "", task22 = "", task23 = ""

, task24 = "", task25 = "", task26 = "", task27 = "", task28 = "", task29 = "", task30 = "";

if(Januar.Task1DateJAN.rawValue == "1"){

task1 = "1.";}

if(Januar.Task2DateJAN.rawValue == "1"){

task2 = "2.";}

if(Januar.Task3DateJAN.rawValue == "1"){

task3 = "3.";}

if(Januar.Task4DateJAN.rawValue == "1"){

task4 = "4.";}

if(Januar.Task5DateJAN.rawValue == "1"){

task5 = "5.";}

if(Januar.Task6DateJAN.rawValue == "1"){

task6 = "6.";}

if(Januar.Task7DateJAN.rawValue == "1"){

task7 = "7.";}

if(Januar.Task8DateJAN.rawValue == "1"){

task8 = "8.";}

if(Januar.Task9DateJAN.rawValue == "1"){

task9 = "9.";}

if(Januar.Task10DateJAN.rawValue == "1"){

task10 = "10.";}

if(Januar.Task11DateJAN.rawValue == "1"){

task11 = "11.";}

if(Januar.Task12DateJAN.rawValue == "1"){

task12 = "12.";}

if(Januar.Task13DateJAN.rawValue == "1"){

task13 = "13.";}

if(Januar.Task14DateJAN.rawValue == "1"){

task14 = "14.";}

if(Januar.Task15DateJAN.rawValue == "1"){

task15 = "15.";}

if(Januar.Task16DateJAN.rawValue == "1"){

task16 = "1.";}

if(Januar.Task17DateJAN.rawValue == "1"){

task17 = "2.";}

if(Januar.Task18DateJAN.rawValue == "1"){

task18 = "3.";}

if(Januar.Task19DateJAN.rawValue == "1"){

task19 = "4.";}

if(Januar.Task20DateJAN.rawValue == "1"){

task20 = "5.";}

if(Januar.Task21DateJAN.rawValue == "1"){

task21 = "6.";}

if(Januar.Task22DateJAN.rawValue == "1"){

task22 = "7.";}

if(Januar.Task23DateJAN.rawValue == "1"){

task23 = "8.";}

if(Januar.Task24DateJAN.rawValue == "1"){

task24 = "9.";}

if(Januar.Task25DateJAN.rawValue == "1"){

task25 = "10.";}

if(Januar.Task26DateJAN.rawValue == "1"){

task26 = "11.";}

if(Januar.Task27DateJAN.rawValue == "1"){

task27 = "12.";}

if(Januar.Task28DateJAN.rawValue == "1"){

task28 = "13.";}

if(Januar.Task29DateJAN.rawValue == "1"){

task29 = "14.";}

if(Januar.Task30DateJAN.rawValue == "1"){

task30 = "15.";}

J1.rawValue = task1 + task2  + task3  + task4  + task5  + task6  + task7  + task8  + task9 + task10  + task11 + task12 + task13  + task14  + task15 + task16 +task17 + task18 + task19 + task20 + task21 + task22 + task23 + task24 + task25 + task26 + task27 + task28 + task29 + task30;

Accepted Solutions (0)

Answers (7)

Answers (7)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

22-12-2016

Hi,

Seems to be a lot happening in your form.  Can you give me some instructions on how to trigger the code.

But I probably wont be able to have a look until some time after Christmas now.

You do seem to have everything happening in the Master Page.  Which is unusual, is there a particular reason for this?

Regards

Bruce

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

20-12-2016

Hi,

I think we will have to see your form to really understand what is required.  I think you will have to create some relationship between the JDNxx fields and the TaskxxDateJan fields, even if it is just a similar name.

Can you upload your form to a file share site, like Dropbox, Google Docs, etc and post a link here.

Regards

Bruce

Avatar

Avatar

Anto_bt

Avatar

Anto_bt

Anto_bt

12-01-2017

Hi Bruce,

Thank you for your message, no I did not resolve, I am trying to make this for next year

Regard,
Anto

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

12-01-2017

Hi Anto,

I'm just back from holidays, seems I might be past your deadline.  Sis you resolve this issue?

Regards

Bruce

Avatar

Avatar

Anto_bt

Avatar

Anto_bt

Anto_bt

22-12-2016

And the buttons on the right are for coloring and Insert numbers in calendar.
Coloring is not so slow, but numbering the formula that I've sent it is very slow

Thank you,
Anto

Avatar

Avatar

Anto_bt

Avatar

Anto_bt

Anto_bt

22-12-2016

Hi,

First I want to thank you about your time.
When i started with calendar, I've made like that. So is it possible to change that.

Ok to explain what calendar is doing here, You have Page1 that is Calendar. Grey is weekend, red is holiday, then you have legend with task down.

2nd page (Page 3)

Payday - which day they transfer salary.

Payday if Holiday - If payday is holiday the to be after or before

then you have Task1 (Aufgabe1) Text for task

After/Before - If payday is 25th and is after then it is 27th, if it is before then it is 23th.

check box if the task is every month or just in some.

Then down I have calculation fields that we will hide at the end this what you see it is for January.
First row is writing, if it is holiday, weekend or working days, based on color

Second row - if it is working day then it is 1

Fourth row - Is to calculate then like that I can see how much working days I have till task.

And the other is calculating for task.

Task 1 date is, date from January for the first Task.

I have big problem because I need to send like gift before New Year, and it is very slow

Regards,
Anto

Avatar

Avatar

Anto_bt

Avatar

Anto_bt

Anto_bt

21-12-2016

Here it is the file Dropbox - Calendar 7.1.pdf

Password for LiveCycle is: GivePermission

Thanks