Hello,
I have a text field who's value is linked to a dropdown field. If the dropdown value changes, the text field automatically changes as well. The text field is disabled as the user should not be able to change the value. The problem I have is that the value of this text field should be saved into a rule input but since I do not interact with the text field, the save into parameter does not trigger. I have no buttons on the interface so I could not add an a!save there. The user does not have to interact with any other field if they don't want so I couldn't put the a!save in another field as well.
Is there a way for the text field to refresh without interacting with it to trigger the save into?
Discussion posts and replies are publicly visible
No field can "save a value" if the user doesn't interact with it.
In your case, you want the value to be saved after the action on the dropdown field, and the text field can merely display that saved value. This is the correct, and only, option.
Thank you Mike, the problem I have is that if I put the a!save in the dropdown field it stores the previous value of the variable because the variable updates its value after the a!save stores it. Is there a way to have that order reverse?
Please share your code.
gabrield295009 said:I put the a!save in the dropdown field it stores the previous value of the variable because the variable updates its value after the a!save stores it.
a!save() statements execute sequentially in the order you put them. that almost always works for cases like this. as stefan mentioned, please share your dropdown code (and i guess also share what your text field is currently doing).
a!textField( label: "Tipo de Producción", value: if(a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), rule!MAQMYD_LI_DESCRIPCIONTECNOLOGIAPORID(tecnologiaId: local!tipoProduccion), ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria']), disabled: true(), saveInto: if(a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), rule!MAQMYD_LI_DESCRIPCIONTECNOLOGIAPORID(tecnologiaId: local!tipoProduccion), ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria']), readOnly: ri!soloLectura, ) a!dropdownField( choiceLabels: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, choiceValues: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, label: "Grupo/subgrupo", labelPosition: "ABOVE", placeholder: "--- Seleccionar grupo/subgrupo ---", value: if(a!isNullOrEmpty(ri!campos.grupo_subgrupo),ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{14139e4f-e991-448b-9f3f-6836130e14b7}grupoNormativo'],ri!campos.grupo_subgrupo), saveInto: { a!save(ri!campos.grupo_subgrupo,save!value), a!save( target: ri!campos.tipo_produccion, value: local!tipoProduccion, ) }, searchDisplay: "AUTO", disabled: ri!soloLectura, )
Thank you Mike and Stefan, I have shared the code
A simple standalone example.
a!localVariables( local!textFieldValue, local!dropdownFieldValue, { a!textField( label: "Text", labelPosition: "ABOVE", disabled: true, value: local!textFieldValue ), a!dropdownField( choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6", "Option 7", "Option 8", "Option 9", "Option 10", "Option 11", "Option 12"}, choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, label: "Dropdown", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", value: local!dropdownFieldValue, saveInto: { local!dropdownFieldValue, local!textFieldValue }, searchDisplay: "AUTO", validations: {} ) } )
It is really hard to follow the logic in your interface ...
Your text field doesn't actually have a valid save target as far as I can see (like even if it were enabled). So I'm not clear what its evaluated value is supposed to be saving into. Your current save target is actually an expression rule, which is not valid and I would expect it to probably break (and i'm surprised if it isn't throwing an error at you).
For my suggested solution I'll need to make some assumptions about what you're really trying to do with that expression rule and where the evaluated value should be saved (for now I just invented a new local variable, "myResolvedValue", though you can change this target to anything you like).
a!dropdownField( choiceLabels: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, choiceValues: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, label: "Grupo/subgrupo", labelPosition: "ABOVE", placeholder: "--- Seleccionar grupo/subgrupo ---", value: if( a!isNullOrEmpty(ri!campos.grupo_subgrupo), ri!solicitud[...], ri!campos.grupo_subgrupo ), saveInto: { a!save( ri!campos.grupo_subgrupo, save!value ), a!save( target: ri!campos.tipo_produccion, value: local!tipoProduccion, ), a!save( target: local!myResolvedValue, value: rule!MAQMYD_LI_DESCRIPCIONTECNOLOGIAPORID(tecnologiaId: local!tipoProduccion) ) }, searchDisplay: "AUTO", disabled: ri!soloLectura, )
There's still the question of where the value of "local!tipoProduccion" is established - we don't actually see where its value is set in either part of your shared code, which is confusing. I assume you might need to handle setting its value *also* in the dropdown's saveInto, though that really depends on details you haven't included.
Hi Mike and Stefan,
Let me share my code again and explain. local!tipoProduccion is a query that brings a recordType with 3 fields. I use one field to match with a dropdown field that has a one to one relationship with it. I show the description of the local!tipoProduccion on the text field and I want to save the Id.
The problem is that the textfield save into does not trigger. I tried adding the a!save on the dropdown field but it saves the old value of the local variable instead of the one I choose at the moment.
local!tipoProduccion: if( a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), rule!MAQMYD_LI_getDescripccionTecnologiaByGrupoSubgrupo(grupo: ri!campos.grupo_subgrupo), a!dropdownField( choiceLabels: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, choiceValues: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL, label: "Grupo/subgrupo", labelPosition: "ABOVE", placeholder: "--- Seleccionar grupo/subgrupo ---", value: if(a!isNullOrEmpty(ri!campos.grupo_subgrupo),ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{14139e4f-e991-448b-9f3f-6836130e14b7}grupoNormativo'],ri!campos.grupo_subgrupo), saveInto: { a!save(ri!campos.grupo_subgrupo,save!value), a!save( target: ri!campos.tipo_produccion, value: local!tipoProduccion['recordType!{d6b3b559-4f09-4c02-b26f-4b3a6d63e2b5}MYD_CU_RT_tecnologia_primaria.fields.{83335c7b-a625-419d-9548-8385a6b9e310}idTecnologiaPrimaria'], ), }, searchDisplay: "AUTO", disabled: ri!soloLectura, ) a!textField( label: "Tipo de Producción", value: if(a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), local!tipoProduccion['recordType!{d6b3b559-4f09-4c02-b26f-4b3a6d63e2b5}MYD_CU_RT_tecnologia_primaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria'], ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria']), saveInto: a!save( ri!campos.grupo_subgrupo, local!tipoProduccion['recordType!{d6b3b559-4f09-4c02-b26f-4b3a6d63e2b5}MYD_CU_RT_tecnologia_primaria.fields.{83335c7b-a625-419d-9548-8385a6b9e310}idTecnologiaPrimaria'] ), disabled: true(), readOnly: ri!soloLectura, )
gabrield295009 said:The problem is that the textfield save into does not trigger.
again, this is expected behavior and indicates that you should be doing your save operation elsewhere.
gabrield295009 said: tried adding the a!save on the dropdown field but it saves the old value of the local variable
the solution to this should be to properly order your saves on the dropdown. Instead of doing the query in the local variable definition of local!tipoProduccion, you will need to do this query in the "save" list of the dropdown.
Thank you Mike, that worked!
great, thanks for confirming