cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-48738%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ECalcolatrice%20tabella%20personalizzata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-48738%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EProblema%3CP%3E%C3%88%20necessario%20creare%20una%20calcolatrice%20personalizzata%20che%20visualizzi%20una%20tabella%20di%20numeri%20basata%20su%20diversi%20valori%20di%20input.%3C%2FP%3ESoluzione%3CP%3EUtilizzare%20le%20caselle%20di%20modifica%20dei%20numeri%20per%20ottenere%20i%20valori%20e%20utilizzare%20il%20metodo%20Set%20Function%20per%20allegare%20JSL%20alle%20caselle%20di%20modifica%20dei%20numeri%20per%20ricalcolare%20la%20tabella%20quando%20i%20valori%20vengono%20modificati.%20Usa%20un%20Table%20Box%20per%20contenere%20colonne%20di%20numeri.%20Ricostruisci%20le%20colonne%20di%20numeri%20quando%20i%20valori%20cambiano.%3C%2FP%3E%3CBR%20%2F%3E%20if(%20jmpversion()%26lt%3B%2213%22%2C%20Open%20Log(1)%3B%20throw(%22richiede%20JMP%2013%20o%20superiore%22))%3B%20%2F%2F%20occorrono%20valori%20predefiniti%20per%20impostare%20le%20caselle%20di%20modifica%20prestito%20%3D%201e5%3B%20anni%20%3D%202%3B%20aprile%20%3D%2015%3B%20cur%20%3D%20%22USD%22%3B%20%2F%2F%20%22EUR%22%20New%20Window(%20%22table%20demo%22%2C%20Border%20Box(%20Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%205%20)%2C%20%2F%2F%20questo%20box%20estende%20il%20verde%20chiaro%20di%20alcuni%20pixel%20V%20List%20Box(%20%2F%2F%20border%20box%20bisogno%20di%20un%20singolo%20figlio%2C%20come%20un%20vlist%2C%20per%20contenere%20tutto%20Border%20Box(%20Left(%2020%20)%2C%20Right(%2020%20)%2C%20top(%2010%20)%2C%20bottom(%2010%20)%2C%20%2F%2F%20il%20bordo%20di%20inserimento%20dati%20H%20List%20Box(%20%2F%2F%20separa%20i%20dati%20campi%20di%20inserimento%20dal%20titolo%20%22Interessante%22%20V%20List%20Box(%20%2F%2F%20i%20tre%20campi%20di%20inserimento%20verticali%20e%20le%20loro%20etichette%20H%20List%20Box(%20%2F%2F%20un%20campo%20e%20la%20sua%20etichetta%20Number%20Edit%20Box(%20%2F%2F%20un%20campo%20in%20prestito%2C%20%26lt%3B%3CSETFORMAT%3E%2012%2C%20month%20-%3D%2012%3B%20year%20%2B%3D%201%3B%20)%3B%20date%5Bi%20%5D%20%3D%20Date%20DMY(%20day%2C%20month%2C%20year%20)%3B%20month%20%2B%3D%201%3B%20)%3B%20While(%20!Is%20Empty(%20tb%20%26lt%3B%26lt%3B%20child%20)%2C%20(tb%20%26lt%3B%26lt%3B%20child)%20%26lt%3B%26lt%3B%20delete%20)%3B%20%2F%2F%20rimuove%20i%20dati%20precedenti%2C%20se%20presenti%20%2F%2F%20aggiunge%20le%20nuove%20colonne%20alla%20tabella%20tb%20%26lt%3B%26lt%3B%20append(%20Number%20Col%20Box(%20%22Due%20Date%22%2C%20date%2C%20%26lt%3B%3CSETFORMAT%3ENon%20sono%20un%20tipo%20di%20finanza.%20Non%20dare%20per%20scontato%20che%20io%20stia%20usando%20correttamente%20le%20formule.%20Ho%20scelto%20sfumature%20di%20verde%20e%20ho%20specificato%20alcuni%20parametri%20del%20table%20box%20per%20rendere%20il%20tavolo%20attraente.%20Non%20sono%20un%20artista%2C%20puoi%20fare%20di%20meglio.%20La%20casella%20spaziatrice%20verde%20crea%20una%20bella%20barra%20di%20colore%20e%20riempie%20la%20pagina%20senza%20allargarla%20utilizzando%20le%20opzioni%20AutoStretching%20e%20MaxSize.%20La%20funzione%20freshen()%20viene%20chiamata%20da%20tutti%20e%20tre%20i%20campi%20di%20immissione%20dati%20e%20non%20importa%20quale%20campo%20%C3%A8%20cambiato.%20Potresti%20fare%20qualcosa%20di%20pi%C3%B9%20complicato%2C%20ma%20a%20meno%20che%20tu%20non%20abbia%20calcoli%20molto%20lenti%2C%20mantienilo%20semplice.%20%C3%88%20possibile%20fare%20clic%20con%20il%20pulsante%20destro%20del%20mouse%20sulla%20tabella%20e%20creare%20una%20tabella%20dati%20per%20elaborare%20ulteriormente%20i%20dati%3B%20potresti%20volere%20un%20modo%20per%20salvare%20i%20parametri%20con%20la%20tabella%20dei%20dati%20(un%20altro%20pulsante%2C%20forse%2C%20per%20creare%20la%20tabella%20dei%20dati).%20%C3%88%20inoltre%20possibile%20inserire%20nel%20journal%20il%20report%20che%20includer%C3%A0%20i%20parametri.%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%20Guarda%20anche%3CP%3EAiuto-%26gt%3BLibri-%26gt%3BGuida%20allo%20scripting%20contiene%20ulteriori%20informazioni%20sui%20Table%20Box%3C%2FP%3E%3C%2FSETFORMAT%3E%3C%2FSETFORMAT%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-487624%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20Calcolatrice%20tabella%20personalizzata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487624%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHo%20iniziato%20a%20scrivere%20script%20all'inizio%20del%202021%20e%20questo%20post%20%C3%A8%20stato%20davvero%20utile.%20Ho%20copiato%20la%20maggior%20parte%20dello%20script%20sopra%20e%20l'ho%20modificato%20per%20la%20mia%20calcolatrice%2C%20il%20cui%20output%20intendo%20utilizzare%20in%20un'altra%20piattaforma.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETuttavia%2C%20non%20sono%20pienamente%20soddisfatto%20di%20ci%C3%B2%20che%20ho%20ottenuto.%20Quando%20apro%20ed%20eseguo%20il%20mio%20script%20per%20la%20prima%20volta%2C%20ottengo%20due%20caselle%20numeriche%20precompilate%20in%20cui%20posso%20inserire%20i%20valori.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22%20padding-left%20%3A%2030px%3B%20%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_0-1652810931455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42485i6DC4371F8A1D4C1C%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Ressel_0-1652810931455.png%22%20alt%3D%22Ressel_0-1652810931455.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%C3%88%20solo%20quando%20cambio%20uno%20dei%20valori%20nelle%20caselle%20numeriche%20precompilate%20che%20appare%20la%20terza%20casella%20con%20il%20risultato%20che%20sono%20effettivamente%20interessato%20a%20utilizzare%20ulteriormente.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22%20padding-left%20%3A%2030px%3B%20%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ressel_2-1652811135800.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42487i6454E026275681FF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Ressel_2-1652811135800.png%22%20alt%3D%22Ressel_2-1652811135800.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPenso%20di%20essermi%20imbattuto%20in%20questo%2C%20perch%C3%A9%20ci%C3%B2%20che%20ho%20creato%20si%20basa%20sul%20codice%20fornito%20da%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F982%22%20target%3D%22_blank%22%3E%20%40Craige_Hales%3C%2FA%3E%20Sopra.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3ECome%20posso%20fare%20in%20modo%20che%20la%20terza%20casella%20(cerchiata%20in%20rosso%20sopra)%20appaia%20dall'inizio%2C%20ma%20sia%20anche%20aggiornata%20in%20base%20ai%20valori%20di%20input%20nelle%20altre%20due%20caselle%3F%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EEsiste%20una%20soluzione%20pi%C3%B9%20efficiente%20per%20costruire%20una%20piccola%20calcolatrice%20o%20sto%20usando%20un%20approccio%20inutilmente%20complicato%3F%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20questo%20punto%20volevo%20anche%20menzionare%20che%2C%20s%C3%AC%2C%20ho%20studiato%20la%20Scripting%20Guide%20cos%C3%AC%20come%20lo%20Scripting%20Index%2C%20ma%20non%20sono%20ancora%20uno%20scripter%20abbastanza%20forte%20per%20trovare%20la%20mia%20soluzione.%20(Non%20ho%20sfogliato%20%22Jump%20into%20JMP%20Scripting%22%2C%20tuttavia%2C%20poich%C3%A9%20al%20momento%20non%20ho%20accesso%20alla%20mia%20copia.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20default%20to%20here%20(%201%20)%3B%0A%0A%2F%2F%20some%20default%20values%20for%20the%20first%20two%20number%20edit%20boxes%0ACurrentConc_wt%25%20%3D%2045.00%3B%0ALowestAcceptConc_wt%25%20%3D%2040.00%3B%0A%0A%0ANew%20Window(%20%22Calculating%20Concentration%20acceptance%20limit%22%2C%0A%20Border%20Box(Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%2020%20)%2C%0A%20%20V%20List%20Box(%0A%20%20%20Text%20Box(%22Some%20comment%22)%0A%20%20)%0A%20)%2C%0A%20%0A%20Border%20Box(Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%2020%20)%2C%0A%20%20V%20List%20Box(%0A%20%20%20Text%20Box(%22Instructions%3A%20%5Badd%20instructions%20here%20later%5D%22)%0A%20%20)%0A%20)%2C%0A%20%0A%20Border%20Box(Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%205%20)%2C%20%2F%2F%20added%20this%20because%20I%20copied%20this%20code%20and%20left%20in%20there%2C%20just%20in%20case...%0A%20%20V%20List%20Box(%20%2F%2F%20border%20boxes%20need%20a%20single%20child%2C%20like%20a%20vlist%2C%20to%20hold%20everything%0A%20%20%20Border%20Box(Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%205%20)%2C%20%2F%2F%20border%20for%20data%20entry%20boxes%0A%20%20%20%20H%20List%20Box(%0A%20%20%20%20%20V%20List%20Box(%0A%20%20%20%20%20%20Border%20Box(Left(%205%20)%2C%20Right(%205%20)%2C%20bottom(%205%20)%2C%0A%20%20%20%20%20%20%20H%20List%20Box(%0A%20%20%20%20%20%20%20%20Number%20Edit%20Box(%20%0A%20%20%20%20%20%20%20%20%20CurrentConc_wt%25%2C%0A%20%20%20%20%20%20%20%20%20%26lt%3B%3CSETFORMAT%3E%3C%2FSETFORMAT%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-487655%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20Calcolatrice%20tabella%20personalizzata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487655%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ECi%20vorr%C3%A0%20un%20po'%20di%20tempo%20prima%20che%20io%20possa%20esaminarlo%20in%20modo%20pi%C3%B9%20approfondito.%20Ma%20penso%20che%20potresti%20semplicemente%20perdere%20la%20chiamata%20alla%20fine%20del%20JSL%20originale%2C%20freshen()%20%2C%20che%20era%20l%C3%AC%20per%20inizializzare%20tutte%20le%20caselle%20come%20se%20qualcosa%20fosse%20gi%C3%A0%20stato%20cliccato.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-487844%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20Calcolatrice%20tabella%20personalizzata%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487844%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EGrazie%2C%20%C3%A8%20stata%20una%20soluzione%20facile.%20Forse%20c'%C3%A8%20motivo%20di%20essere%20soddisfatti%2C%20dopotutto.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Custom Table Calculator

Problem

You need to build a custom calculator that displays a table of numbers based on several input values.

Solution

Use Number Edit Boxes to get the values and use the Set Function method to attach JSL to the Number Edit Boxes to recalculate the table when the values are changed. Use a Table Box to hold columns of numbers. Rebuild the columns of numbers when the values change.

Payment table built in a Table BoxPayment table built in a Table Box
if( jmpversion()<"13", Open Log(1); throw("requires JMP 13 or greater"));

// need default values to set up the edit boxes
borrow = 1e5;
years = 2;
apr = 15;

cur = "USD"; // "EUR"

New Window( "table demo",
	Border Box( Left( 5 ), Right( 5 ), bottom( 5 ), // this box extends the pale green a few pixels
		V List Box( // border boxes need a single child, like a vlist, to hold everything
			Border Box( Left( 20 ), Right( 20 ), top( 10 ), bottom( 10 ), // the data entry border
				H List Box( // separate the data entry fields from "Interesting" title
					V List Box( // the three vertical entry fields and their labels
						H List Box( // a field and its label
							Number Edit Box( // a field
								borrow,
								<<setformat( 13, "Currency", cur ), // JMP 14 sets the formatM
								<<Set Function( // a callback function for responding when the
									Function( {this}, // entry fields change
										borrow = this << get; // get the current value
										freshen(); // run the common code
									)
								)
							),
							Text Box( " amount" ) // label the entry field, space it over a bit
						),
						H List Box( // ditto
							Number Edit Box(
								years,
								<<setformat( 13, "Best" ),
								<<Set Function(
									Function( {this},
										years = this << get;
										freshen();
									)
								)
							),
							Text Box( " years" )
						),
						H List Box( // ditto
							Number Edit Box(
								apr,
								<<setformat( 13, "Best" ),
								<<Set Function(
									Function( {this},
										apr = this << get;
										freshen();
									)
								)
							),
							Text Box( " apr" )
						)
					),
					Border Box( Left( 100 ), Text Box( "Interesting", <<setfontsize( 40 ) ) ) // label
				)
			),
			Spacer Box( size( 10, 10 ), color( "dark green" ), <<setAutoStretching( 1, 0 ), <<setMaxSize( 1e5, 10 ) ),
			tb = Table Box( // here's the table box. You could put columns here, but
				// the freshen function will do that in a second, using "tb".
				<<setShadeAlternateRows( 1 ), // set the table properties to make a green-bar report
				<<setShadeHeadings( 0 ),
				<<setHeadingColumnBorders( 0 ),
				<<setUnderlineHeadings( 1 ),
				<<setColumnBorders( 0 ),
				<<setRowBorders( 0 ),
				<<setShadeCells( 0 )
			)
		),
		<<backgroundcolor( RGB Color( 245, 255, 245 ) ) // pale green
	)
);


freshen = Function( {},
	{// local variables
	rate = (apr / 100) / 12, day = Min( 28, Day( Today() ) ), month = Month( Today() ), year = Year( Today() ), dates = J( 1 + years * 12, 1, 0 ), i,
	payment = Payment( rate, 12 * years, borrow ), interest = -Interest Payment( rate, 0 :: 12 * years, 12 * years, borrow ), principal =
	-Principal Payment( rate, 0 :: 12 * years, 12 * years, borrow ), payment2 = interest + principal, balance =
	Present Value( rate, 12 * years :: 0, payment, 0 ), CumulativeInterest = Cumulative Sum( interest )}, 

	
	For( i = 1, i <= N Rows( dates ), i++,
		If( month > 12,
			month -= 12;
			year += 1;
		);
		dates[i] = Date DMY( day, month, year );
		month += 1;
	);
	
	While( !Is Empty( tb << child ), (tb << child) << delete ); // remove previous data, if any
	
	// add the new columns to the table
	tb << append( Number Col Box( "Due Date", dates, <<setformat( 11, "yyyy-mm-dd" ) ) );
	tb << append( Number Col Box( "Payment to Principal", principal, <<setformat( 13, "Currency", cur ) ) );
	tb << append( Number Col Box( "Payment to Interest", interest, <<setformat( 13, "Currency", cur ) ) );
	tb << append( Number Col Box( "Cumulative Interest", CumulativeInterest, <<setformat( 13, "Currency", cur ) ) );
	tb << append( Number Col Box( "Monthly Payment", payment2, <<setformat( 13, "Currency", cur ) ) );
	tb << append( Number Col Box( "Outstanding Balance", balance, <<setformat( 13, "Currency", cur ) ) );
	0;// return nothing
);

freshen();

Discussion

I'm not a finance guy. Don't assume I'm using the formulas correctly. I chose shades of green and specified some table box parameters to make the table attractive. I'm not an artist, you can do better. The green spacer box makes a nice bar of color and fills the page without making the page wider by using the AutoStretching and MaxSize options. The freshen() function is called from all three data entry fields and doesn't care which field changed. You could do something more complicated, but unless you have really slow calculations, keep it simple. You can right-click the table and make into data table to further process the data; you might want a way to save the parameters with the data table (another button, perhaps, to make the data table). You can also journal the report which will include the parameters.


See Also

Help->Books->Scripting Guide has more information about Table Boxes

Comments
Ressel

Started scripting early 2021 and this post was really useful. I copied most of the script above and modified it for my own calculator, the output of which I am planning to use in another platform.

 

However, I am not fully satisfied with what I have achieved. When I open and run my script the first time, I get two pre-filled number boxes where I can enter values.

 

Ressel_0-1652810931455.png

 

It is only when I change one of the values in the pre-filled number boxes, that the third box with the result I am actually interested in using further appears.

 

Ressel_2-1652811135800.png

 

I think I ran into this, because what I created is based on the code provided by @Craige_Hales above.

 

  • How can I make it, that the third box (circled in red above) appears from the beginning, but is also updated based on the input values in the other two boxes?
  • Is there a more efficient solution to building a small calculator or am using an unnecessarily complicated approach?

 

At this point I also wanted to mention that, yes, I have been studying the Scripting Guide as well as the Scripting Index, but I am not yet a strong enough scripter to come up with my own solution. (I did not browse through "Jump into JMP Scripting" though, as I currently do not have access to my copy.)

 

Names default to here ( 1 );

// some default values for the first two number edit boxes
CurrentConc_wt% = 45.00;
LowestAcceptConc_wt% = 40.00;


New Window( "Calculating Concentration acceptance limit",
	Border Box(Left( 5 ), Right( 5 ), bottom( 20 ),
		V List Box(
			Text Box("Some comment")
		)
	),
	
	Border Box(Left( 5 ), Right( 5 ), bottom( 20 ),
		V List Box(
			Text Box("Instructions: [add instructions here later]")
		)
	),
	
	Border Box(Left( 5 ), Right( 5 ), bottom( 5 ), // added this because I copied this code and left in there, just in case...
		V List Box( // border boxes need a single child, like a vlist, to hold everything
			Border Box(Left( 5 ), Right( 5 ), bottom( 5 ), // border for data entry boxes
				H List Box(
					V List Box(
						Border Box(Left( 5 ), Right( 5 ), bottom( 5 ),
							H List Box(
								Number Edit Box( 
									CurrentConc_wt%,
									<<setformat ( "Fixed Dec", 12, 2 ),
									<<Set Function(
										Function( {this},
											CurrentConc_wt% = this << get;
											freshen();
										)
									)
								),
								Text Box(" Concentration, current [wt%]") // label for entry field, with a little space between them
							)
						),
					),
					V List Box(
						Border Box(Left( 5 ), Right( 5 ), bottom( 5 ),
							H List Box(
								Number Edit Box( 
									LowestAcceptConc_wt%,
									<<setformat ( "Fixed Dec", 12, 2 ),
									<<Set Function(
										Function( {this},
											LowestAcceptConc_wt% = this << get;
											freshen();
										)
									)
								),
								Text Box(" Concentration, lowest acceptable [wt%]") // label for entry field, ...
							)
						),
						bb = Border Box(Left( 5 ), Right( 5 ), bottom( 5 ),
						),
					),
				)
			)
		)
	)
);

freshen = Function ( {}, 
	{LowestAcceptConc_%rel = LowestAcceptConc_wt%/CurrentConc_wt% * 100},

	While( !Is Empty( bb << child ), (bb << child) << delete );

	bb << append (H List Box(
								Number Edit Box( 
									LowestAcceptConc_%rel,
									<<setformat ( "Fixed Dec", 12, 2 ),
								),
								Text Box(" Acceptance limit [% rel.]") // label ...
							)
			);
);

 

It will be a little while before I can look at this in more depth. But I think you may just be missing the call at the very end of the original JSL, freshen() , which was there to initialize all of the boxes as if something had been clicked already.

Ressel

Thanks, that was an easy fix. Perhaps there's reason to be satisfied after all.

JSL Cookbook

If you’re looking for a code snippet or design pattern that performs a common task for your JSL project, the JSL Cookbook is for you.

This knowledge base contains building blocks of JSL code that you can use to reduce the amount of coding you have to do yourself.

It's also a great place to learn from the experts how to use JSL in new ways, with best practices.