Home Forums Development CPM – recalculate attribute from model after form load

Viewing 1 reply thread
  • Author
    Posts
    • #12283
      Nexj Uaenexj uae
      Participant

      (: 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
    • #12293
      Johnny ZhangJohnny Zhang
      Participant

      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
Viewing 1 reply thread
  • You must be logged in to reply to this topic.