Home › Forums › Development › CPM – recalculate attribute from model after form load
- This topic has 1 reply, 2 voices, and was last updated 5 years, 2 months ago by Johnny Zhang.
-
AuthorPosts
-
-
October 8, 2019 at 10:30 am #12283nexj uaeParticipant
(: onServer ‘(value)) is not working. this is getting called only at form creation or reseed.
We have the below code for getting the approval history in to form.
(: onServer ‘(value enabled)) – this is recalculating enabled property , but not value.(bp:page
Submit
(: caption “Submit the Changes”)
(bp:section
cddApprovalHistory
;(: visible #f)
(bp:textarea
approvalHistory_Text
(: caption “Approval History”)
(: enabled (refreshEditibility (@ question relObjectId)))
(: value (getApprovalHistory (@ question relObjectId)))
(: onServer ‘(value enabled))
(: sync #f)
)
)
)cddLibrary.scm
(define (getApprovalHistory inst)
(let*
(
(extHistoryColl
(enbd:TransactionExceptionExternalHistory’read
‘()
`(= (@ serviceRequest enbdCDD) ,(string->oid inst))
‘((enbdEndDateTime . #f))
‘()
‘()
‘()
)
)
(strApprovalHistory “”)
)
(unless (extHistoryColl’empty)
(for-each
(lambda (extHistoryInst)
(set! strApprovalHistory
(string-affix
(string-append
“Name of Approver: ”
(extHistoryInst’enbdFullName)
“; Designation: ”
(extHistoryInst’enbdWorkedBy)
“; Date & Time: ”
(string-collection-affix
“-”
(unless (null? (extHistoryInst’enbdStartDateTime))
(number->string (date-part ‘day (extHistoryInst’enbdStartDateTime)))
)
(unless (null? (extHistoryInst’enbdStartDateTime))
(number->string (date-part ‘month (extHistoryInst’enbdStartDateTime)))
)
(unless (null? (extHistoryInst’enbdStartDateTime))
(number->string (date-part ‘year (extHistoryInst’enbdStartDateTime)))
)
)
)
“\r\n\n”
strApprovalHistory
)
)
)
extHistoryColl
)
;return
strApprovalHistory
)
)
)0 -
October 8, 2019 at 1:03 pm #12293Johnny ZhangParticipant
different properties recalculate on different conditions.
enabled property recalculates on form launch and on dependency updates.
value property recalculates on initial form launch, and on dependency updates. e.g. when a dependent value (e.g. (@ question q1)) changes value.
note, value property does not recalculate on form refresh for performance reasons.
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.