I am having a editable grid in that there is a field that should autopopulate a value
eg. there are two fields start date and end date I want to find the difference and then in days field it autopopulate the no of days
In interface level the value is showing in that field but it is not saving in rule input
Discussion posts and replies are publicly visible
As start date, end date and day values are auto populated then please set them in the CDT/ dictionary/ map at the start of your UI, don`t use default value function in the value. Whenever there is a change in the start date or end date recalculate the difference and store it in the day.
Only no of days needs to be auto populate after user selecting the start date and end date
then in saveinto set the value of differnece in case of whenever user set value in any of the date field.
Apply the below logic on your end date it will directly save the number of days to your rule input.
a!dateField( label: "End Date", value: ri!date, saveInto: { ri!date, a!save( ri!days, tointeger(tointervalds(save!value) -tointervalds(today()))/*today is your start date*/ ) } )
I was using a grid field In that the value is not saving
share some reference for your code it should work.
a!integerField( value: ( if( a!isNullOrEmpty( ri!RMS_AddResourceModelContractPricing.enddate ), {}, ( tointeger( tointervalds( ri!RMS_AddResourceModelContractPricing.enddate) - tointervalds(ri!RMS_AddResourceModelContractPricing.startdate ) ) ) ) ), saveInto: fv!item.demandhours ),
This code for no.of days grid field
Actually you are passing the logic in the value field try to pass the same on the saveInto end date field. Save Into for a field works when you perform some action on that field.
Use the below code for saveInto of your end date. Value will be saved to your rule input.
{ fv!item.enddate if( a!isNullOrEmpty( fv!item.enddate ), {}, a!save( fv!item.demandhours, ( tointeger( tointervalds(save!value) - tointervalds(fv!item.startdate) ) ) ) ) ) }
It's Worked Thanks