cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-48738%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ECalculadora%20de%20tabla%20personalizada%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-48738%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EProblema%3CP%3EDebe%20crear%20una%20calculadora%20personalizada%20que%20muestre%20una%20tabla%20de%20n%C3%BAmeros%20basada%20en%20varios%20valores%20de%20entrada.%3C%2FP%3ESoluci%C3%B3n%3CP%3EUse%20los%20cuadros%20de%20edici%C3%B3n%20de%20n%C3%BAmeros%20para%20obtener%20los%20valores%20y%20use%20el%20m%C3%A9todo%20Establecer%20funci%C3%B3n%20para%20adjuntar%20JSL%20a%20los%20cuadros%20de%20edici%C3%B3n%20de%20n%C3%BAmeros%20para%20volver%20a%20calcular%20la%20tabla%20cuando%20se%20cambien%20los%20valores.%20Use%20un%20cuadro%20de%20tabla%20para%20contener%20columnas%20de%20n%C3%BAmeros.%20Reconstruya%20las%20columnas%20de%20n%C3%BAmeros%20cuando%20cambien%20los%20valores.%3C%2FP%3E%3CBR%20%2F%3E%20if(%20jmpversion()%26lt%3B%2213%22%2C%20Abrir%20registro(1)%3B%20throw(%22requiere%20JMP%2013%20o%20superior%22))%3B%20%2F%2F%20necesita%20valores%20predeterminados%20para%20configurar%20los%20cuadros%20de%20edici%C3%B3n%20pr%C3%A9stamo%20%3D%201e5%3B%20a%C3%B1os%20%3D%202%3B%20abril%20%3D%2015%3B%20actual%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%20este%20cuadro%20extiende%20el%20verde%20p%C3%A1lido%20unos%20pocos%20p%C3%ADxeles%20V%20List%20Box(%20%2F%2F%20border%20boxes%20necesita%20un%20solo%20elemento%20secundario%2C%20como%20una%20vlist%2C%20para%20contener%20todo%20Border%20Box%20(Izquierda%20(20)%2C%20Derecha%20(20)%2C%20arriba%20(10)%2C%20abajo%20(10)%2C%20%2F%2F%20el%20borde%20de%20entrada%20de%20datos%20H%20List%20Box%20(%2F%20separa%20los%20datos%20campos%20de%20entrada%20del%20t%C3%ADtulo%20%22Interesante%22%20V%20List%20Box(%20%2F%2F%20los%20tres%20campos%20de%20entrada%20verticales%20y%20sus%20etiquetas%20H%20List%20Box(%20%2F%2F%20un%20campo%20y%20su%20etiqueta%20Number%20Edit%20Box(%20%2F%2F%20un%20campo%20prestado%2C%20%26lt%3B%3CSETFORMAT%3E%2012%2C%20mes%20-%3D%2012%3B%20a%C3%B1o%20%2B%3D%201%3B)%3B%20fechas%20%5Bi%20%5D%20%3D%20Fecha%20DMY(%20d%C3%ADa%2C%20mes%2C%20a%C3%B1o%20)%3B%20mes%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%20elimina%20los%20datos%20anteriores%2C%20si%20los%20hay%20%2F%2F%20agrega%20las%20nuevas%20columnas%20a%20la%20tabla%20tb%20%26lt%3B%26lt%3B%20append(%20Number%20Col%20Box(%20%22Fecha%20de%20vencimiento%22%2C%20fechas%2C%20%26lt%3B%3CSETFORMAT%3ENo%20soy%20un%20tipo%20de%20finanzas.%20No%20asuma%20que%20estoy%20usando%20las%20f%C3%B3rmulas%20correctamente.%20Eleg%C3%AD%20tonos%20de%20verde%20y%20especifiqu%C3%A9%20algunos%20par%C3%A1metros%20del%20cuadro%20de%20la%20tabla%20para%20hacerla%20atractiva.%20No%20soy%20un%20artista%2C%20puedes%20hacerlo%20mejor.%20El%20cuadro%20espaciador%20verde%20crea%20una%20bonita%20barra%20de%20color%20y%20llena%20la%20p%C3%A1gina%20sin%20hacerla%20m%C3%A1s%20ancha%20usando%20las%20opciones%20AutoStretching%20y%20MaxSize.%20La%20funci%C3%B3n%20freshen()%20se%20llama%20desde%20los%20tres%20campos%20de%20entrada%20de%20datos%20y%20no%20le%20importa%20qu%C3%A9%20campo%20cambi%C3%B3.%20Podr%C3%ADas%20hacer%20algo%20m%C3%A1s%20complicado%2C%20pero%20a%20menos%20que%20tengas%20c%C3%A1lculos%20realmente%20lentos%2C%20mantenlo%20simple.%20Puede%20hacer%20clic%20con%20el%20bot%C3%B3n%20derecho%20en%20la%20tabla%20y%20convertirla%20en%20una%20tabla%20de%20datos%20para%20seguir%20procesando%20los%20datos%3B%20es%20posible%20que%20desee%20una%20forma%20de%20guardar%20los%20par%C3%A1metros%20con%20la%20tabla%20de%20datos%20(otro%20bot%C3%B3n%2C%20quiz%C3%A1s%2C%20para%20hacer%20la%20tabla%20de%20datos).%20Tambi%C3%A9n%20puede%20registrar%20en%20diario%20el%20informe%20que%20incluir%C3%A1%20los%20par%C3%A1metros.%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%20Ver%20tambi%C3%A9n%3CP%3EAyuda-%26gt%3BLibros-%26gt%3BGu%C3%ADa%20de%20secuencias%20de%20comandos%20tiene%20m%C3%A1s%20informaci%C3%B3n%20sobre%20Table%20Boxes%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%3ERe%3A%20Calculadora%20de%20tablas%20personalizadas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487624%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EComenc%C3%A9%20a%20escribir%20scripts%20a%20principios%20de%202021%20y%20esta%20publicaci%C3%B3n%20fue%20realmente%20%C3%BAtil.%20Copi%C3%A9%20la%20mayor%20parte%20del%20script%20anterior%20y%20lo%20modifiqu%C3%A9%20para%20mi%20propia%20calculadora%2C%20cuyo%20resultado%20planeo%20usar%20en%20otra%20plataforma.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESin%20embargo%2C%20no%20estoy%20completamente%20satisfecho%20con%20lo%20que%20he%20logrado.%20Cuando%20abro%20y%20ejecuto%20mi%20secuencia%20de%20comandos%20por%20primera%20vez%2C%20obtengo%20dos%20cuadros%20de%20n%C3%BAmeros%20precargados%20donde%20puedo%20ingresar%20valores.%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%3ESolo%20cuando%20cambio%20uno%20de%20los%20valores%20en%20los%20cuadros%20de%20n%C3%BAmeros%20precargados%2C%20aparece%20el%20tercer%20cuadro%20con%20el%20resultado%20que%20realmente%20me%20interesa%20usar%20m%C3%A1s.%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%3ECreo%20que%20me%20encontr%C3%A9%20con%20esto%2C%20porque%20lo%20que%20cre%C3%A9%20se%20basa%20en%20el%20c%C3%B3digo%20proporcionado%20por%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%20arriba.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3E%C2%BFC%C3%B3mo%20puedo%20hacer%20que%20el%20tercer%20cuadro%20(marcado%20con%20un%20c%C3%ADrculo%20en%20rojo%20arriba)%20aparezca%20desde%20el%20principio%2C%20pero%20tambi%C3%A9n%20se%20actualice%20en%20funci%C3%B3n%20de%20los%20valores%20de%20entrada%20en%20los%20otros%20dos%20cuadros%3F%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3E%C2%BFExiste%20una%20soluci%C3%B3n%20m%C3%A1s%20eficiente%20para%20construir%20una%20calculadora%20peque%C3%B1a%20o%20estoy%20usando%20un%20enfoque%20innecesariamente%20complicado%3F%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEn%20este%20punto%2C%20tambi%C3%A9n%20quer%C3%ADa%20mencionar%20que%2C%20s%C3%AD%2C%20he%20estado%20estudiando%20la%20Gu%C3%ADa%20de%20secuencias%20de%20comandos%2C%20as%C3%AD%20como%20el%20%C3%8Dndice%20de%20secuencias%20de%20comandos%2C%20pero%20a%C3%BAn%20no%20soy%20un%20creador%20de%20secuencias%20de%20comandos%20lo%20suficientemente%20fuerte%20como%20para%20encontrar%20mi%20propia%20soluci%C3%B3n.%20(Sin%20embargo%2C%20no%20navegu%C3%A9%20a%20trav%C3%A9s%20de%20%22Jump%20into%20JMP%20Scripting%22%2C%20ya%20que%20actualmente%20no%20tengo%20acceso%20a%20mi%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%3ERe%3A%20Calculadora%20de%20tablas%20personalizadas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487655%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EPasar%C3%A1%20un%20tiempo%20antes%20de%20que%20pueda%20ver%20esto%20con%20m%C3%A1s%20profundidad.%20Pero%20creo%20que%20es%20posible%20que%20te%20est%C3%A9s%20perdiendo%20la%20llamada%20al%20final%20del%20JSL%20original%2C%20freshen()%20%2C%20que%20estaba%20all%C3%AD%20para%20inicializar%20todas%20las%20casillas%20como%20si%20ya%20se%20hubiera%20hecho%20clic%20en%20algo.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-487844%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20Calculadora%20de%20tablas%20personalizadas%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487844%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EGracias%2C%20esa%20fue%20una%20soluci%C3%B3n%20f%C3%A1cil.%20Quiz%C3%A1s%20haya%20razones%20para%20estar%20satisfecho%20despu%C3%A9s%20de%20todo.%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.