You are viewing limited content. For full access, please sign in.

Question

Question

Row not tabulating correct Conditions

asked on October 6, 2023 Show version history

Hi all,

I have a strange form behavior using the following fields attached in the image (Laserfiche Cloud).

When I flicker the Radio Button ${Confirm Business Match} from "Yes" to "No" and back to "Yes" it does not tally the conditions per ROW() in the apply License task for the collection.

It should revert to the first image but applies the "YES" to EVERY row. Here is the field Code for the ${Eligible for Renewal?} Field:

=IF(AND(INDEX(License_Collection.License_ExpirationInterval,ROW())>=-1,INDEX(License_Collection.License_ExpirationInterval,ROW())<=3,INDEX(License_Collection.License_PreviousStatus,ROW())="APPROVED",Result_ConfirmMatch="YES"),"YES","NO")



Adding an index(row()) to Result_ConfirmMatch doesn't do it. It behaves correctly when I add new rows, just the flicker is the issue. I would rather not have to execute Javascript to Delete all the rows the USER just added, but I'm considering it... Thanks!!

 

UPDATE:

I've added the following Javascript to Delete the rows if someone plays with the radio button while there are active Licenses... but If the Calculation Field is bad I'd rather fix that:

// /* LF Bug Compensations 
// Function to Remove all Licenses if the Business Match Changes
function removeAllLicenses () {
  let ApplicationType = normalize(LFForm.getFieldValues(_ApplicationType))
  if (ApplicationType) {
    for (let i=0; i < ApplicationType.length; i++){
      LFForm.deleteSet(_LicenseCollection, 0)
    }
  }
}
// */

 

0 0

Answer

SELECTED ANSWER
replied on October 10, 2023 Show version history

I've ditched the field Calculation and applied the following per row using JavaScript:
 

// Tabulate if the name matches per row (SAMPLE)

function evaluatePerRow() {

    for (let i=0; i < collectionSize()-1; i++){

        let firstName = normalize(LFForm.getFieldValues(_EntryFirst))[i]
        let lastName = normalize(LFForm.getFieldValues(_EntryLast))[i]
        let fullName = normalize(LFForm.getFieldValues(_FullNameDB))[i]

        // Have to clone the object to assign an index within the Collection Set
        let injectMatchDB = {..._MatchDB}
        Object.assign(injectMatchDB, {index: i})

        if (`${firstName} ${lastName}` == fullName) {

            LFForm.setFieldValues(injectMatchDB, {value: "YES"}) }

        else { LFForm.setFieldValues(injectMatchDB, {value: "NO"}) }
    }
}

 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.