Click here to Skip to main content
15,886,815 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: Finally... Pin
GuyThiebaut15-Aug-20 23:23
professionalGuyThiebaut15-Aug-20 23:23 
AnswerRe: Finally... Pin
Sandeep Mewara16-Aug-20 0:50
mveSandeep Mewara16-Aug-20 0:50 
AnswerRe: Finally... Pin
theoldfool16-Aug-20 1:14
professionaltheoldfool16-Aug-20 1:14 
AnswerRe: Finally... Pin
Gerry Schmitz16-Aug-20 4:29
mveGerry Schmitz16-Aug-20 4:29 
AnswerRe: Finally... Pin
Nelek16-Aug-20 4:46
protectorNelek16-Aug-20 4:46 
AnswerRe: Finally... Pin
mngerhold18-Aug-20 1:05
mngerhold18-Aug-20 1:05 
GeneralHappy Birthday Brisingr Aerowing! Pin
OriginalGriff15-Aug-20 19:55
mveOriginalGriff15-Aug-20 19:55 
GeneralThe most unappreciated work PinPopular
kmoorevs15-Aug-20 13:20
kmoorevs15-Aug-20 13:20 
...is often the most time consuming. It's a simple enough ask:
Enable calculated labels in a webforms page. How hard can that be?

The challenge:
This part of the project involves review forms created by/for the customer. To keep it short, these are dynamic forms that consist of a question and the customer's choice of any basic input control including labels and textboxes.

I needed some way to allow the customer to create JavaScript for those controls that they wanted to be used in a calculation...without actually writing JavaScript...the simpler the better.

What I came up with is likely just the first phase of the solution and lets them tag textboxes with a function name and variable name. A label can also be tagged with a function name and at least a rudimentary equation can be built using the textbox variables. Additionally other statements may also be appended enabling function chaining. (so I can calculate a total which calculates an average which calculates an adjusted average, etc.)

It looks like this for a textbox:
five_day_total:day_one

For the label that receives the calculation, it look like this:
=five_day_total:day_one + day_two + day_three + day_four + day_five; five_day_avg(result); five_day_avg_adj(result):1

This shows the script that would generate a calculation/result along with two chained functions. The last argument is just the number of decimal places and is optional.

A label that is the result of a chained function might be tagged as:
=five_day_avg(sumValue):Number(sumValue) / 5:1


Anyhow, it's taken me the better part of 3 days to get it all working. I'd bet that the end user never notices, or if they do have absolutely no idea of the cursing that went into making a bit of text change. Sigh | :sigh: Also depressing is that it's likely a one-off method of injecting JavaScript that I'll never need again.

Oh well, the hard bit is done...time to move on to other more visible items on the punch list. This project (started in March and affectionately called my Covid project) is about 90% done and is due in 2 weeks. I have worked pretty much every weekend over the last 5 months trying to stay on course. I really need a vacation! Laugh | :laugh:

If you've made it this far, thanks for reading. I hope your weekend is more fun than mine! Smile | :)
"Go forth into the source" - Neal Morse


modified 15-Aug-20 19:29pm.

GeneralRe: The most unappreciated work Pin
yacCarsten15-Aug-20 18:15
yacCarsten15-Aug-20 18:15 
GeneralRe: The most unappreciated work Pin
kholsinger17-Aug-20 5:56
kholsinger17-Aug-20 5:56 
RantRe: The most unappreciated work Pin
Gary R. Wheeler16-Aug-20 2:28
Gary R. Wheeler16-Aug-20 2:28 
GeneralRe: The most unappreciated work Pin
Greg Utas16-Aug-20 2:51
professionalGreg Utas16-Aug-20 2:51 
GeneralRe: The most unappreciated work Pin
W Balboos, GHB16-Aug-20 2:51
W Balboos, GHB16-Aug-20 2:51 
GeneralRe: The most unappreciated work Pin
milo-xml17-Aug-20 2:10
professionalmilo-xml17-Aug-20 2:10 
GeneralRe: The most unappreciated work Pin
Bruce Patin17-Aug-20 3:17
Bruce Patin17-Aug-20 3:17 
GeneralGood grief - at last! Grand Tour S04E02 release date. Pin
OriginalGriff15-Aug-20 11:21
mveOriginalGriff15-Aug-20 11:21 
QuestionIs a programming language's aesthetics important? Pin
Marc Clifton15-Aug-20 11:05
mvaMarc Clifton15-Aug-20 11:05 
AnswerRe: Is a programming language's aesthetics important? Pin
Greg Utas15-Aug-20 12:00
professionalGreg Utas15-Aug-20 12:00 
GeneralRe: Is a programming language's aesthetics important? Pin
Stuart Dootson16-Aug-20 22:48
professionalStuart Dootson16-Aug-20 22:48 
GeneralRe: Is a programming language's aesthetics important? Pin
Greg Utas17-Aug-20 0:37
professionalGreg Utas17-Aug-20 0:37 
GeneralRe: Is a programming language's aesthetics important? Pin
Dan Neely17-Aug-20 2:23
Dan Neely17-Aug-20 2:23 
AnswerRe: Is a programming language's aesthetics important? Pin
Jon McKee15-Aug-20 12:42
professionalJon McKee15-Aug-20 12:42 
GeneralRe: Is a programming language's aesthetics important? Pin
englebart17-Aug-20 7:35
professionalenglebart17-Aug-20 7:35 
GeneralRe: Is a programming language's aesthetics important? Pin
Jon McKee17-Aug-20 8:39
professionalJon McKee17-Aug-20 8:39 
PraiseRe: Is a programming language's aesthetics important? Pin
englebart17-Aug-20 9:31
professionalenglebart17-Aug-20 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.