Issue in Transform

Hi.

This transform is not working after adding the “lifecycle” . Getting “exception while calculating the value for this attribute”.

{

"name": "UserLevel",
"type": "static",
"attributes": {
    "studentLevel": {
        "attributes": {
            "sourceName": "Student Banner replica",
            "attributeName": "STUDENT_LEVEL"
        },
        "type": "accountAttribute"
    },
    "status": {
        "attributes": {
            "sourceName": "Student Banner replica",
            "attributeName": "STUDENT_STATUS"
        },
        "type": "accountAttribute"
    },
    "levelCode": {
        "attributes": {
            "values": [
                {
                    "attributes": {
                        "attributeName": "STUDENT_YEAR_CODE",
                        "sourceName": "Student Banner replica"
                    },
                    "type": "accountAttribute"
                },
                {
                    "attributes": {
                        "value": "blank"
                    },
                    "type": "static"
                }
            ]
        },
        "type": "firstValid"
    },
    "lifecycle": {
        "attributes": {
            "values": [
                {
                    "attributes": {
                        "attributeName": "cloudLifecycleState"
                    },
                    "type": "identityAttribute"
                },
                {
                    "attributes": {
                        "value": "blank"
                    },
                    "type": "static"
                }
            ]
        },
        "type": "firstValid"
    },
    "value": "#if(($studentLevel=='MD' || $studentLevel=='DE') && ($levelCode.startsWith('01') || $levelCode.startsWith('02') || $levelCode.startsWith('03') || $levelCode.startsWith('04') || $levelCode.startsWith('05') || $levelCode.startsWith('06') || $levelCode.startsWith('07') || $levelCode.startsWith('08') || $levelCode.startsWith('09')) && $levelCode != '99')U/G Year #if($levelCode.contains('0'))$levelCode.replace('0','')#{else}$levelCode#end#elseif($studentLevel=='TP')Masters Student#elseif($studentLevel=='RP')P/G#elseif($studentLevel=='UG' && $levelCode.contains(\"A\"))U/G Abroad#elseif($studentLevel == 'UG' && $levelCode == '99'))U/G Year Unknown#elseif(($studentLevel == 'UG' && ($levelCode.startsWith('01') || $levelCode.startsWith('02') || $levelCode.startsWith('03') || $levelCode.startsWith('04') || $levelCode.startsWith('05') || $levelCode.startsWith('06') || $levelCode.startsWith('07') || $levelCode.startsWith('08') || $levelCode.startsWith('09')) && $levelCode != '99'))U/G Year #if($levelCode.contains('0'))$levelCode.replace('0','')#{else}$levelCode#end#elseif($studentLevel == 'UG' && $levelCode == 'blank' && $status == 'RE')U/G Unregistered#else U/G Unknown#end#elseif($lifecycle == 'inactive')Disabled Students User#elseif($lifecycle == 'lapsed')lapsed Students User#end"
},
"internal": false

}

Hi @Harish_accenture,

Try adding an #{else}Unknown condition before you end the logic.

It is not working only when evaluation following condition #elseif($lifecycle == ‘inactive’)Disabled Students User#elseif($lifecycle == ‘lapsed’)lapsed Students User#end. It is working without this.

@atarodia - Yes, I tried but it didn’t work.

In the condition just before #elseif($lifecycle == ‘inactive’)Disabled, you are using #else U/G Unknown#end

Try changing that #else to #{else}

I think there’s bigger issues with this transform.

You have the following :

  • if
    • if
    • else
    • end
  • elseif
  • elseif
  • elseif
  • elseif
  • elseif
  • elseif
    • if
    • else
    • end
  • elseif
  • else
  • end
  • elseif
  • elseif
  • end

assuming those if/else/ends should be nested where they are, those are fine, but you have two elseifs and an end at the end that don’t match up to anything.

2 Likes

It worked. Thank you!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.