Hello,
I am thinking how I can achieve something like this with seal only,
a!localVariables( local!data: if( isnull(local!a1), updatedictionary(), /* Second Condition */ if(isnull(local!b1), ), ), null ), local!data )
basically if condition for null value, if it is null exit, if it is not null do action and that check next value, problem is that in the if there are condition, true(), false()) where it does not allows a action with another if inside the result part.
Any idea which is the best approach ?
Discussion posts and replies are publicly visible
Hi Vladimir, you should be able to achieve this but the solution will depend on where you are performing this and what it is doing. Is this used for a!save() when a button is depressed or a field is changed, or what are we doing here exactly, etc?
Some quick examples with saving data on button press, Submit 1 cascades the if() statements and Submit 2 separates them out independantly.
a!localVariables( local!data1: null, local!data2: "test", local!value1, local!value2, a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit 1", submit: true, saveInto: { if( isnull(local!data1), {}, /* do nothing */ if( isnull(local!data2), {}, /* do nothing */ a!save(local!value2,"test") ) ) } ), a!buttonWidget( label: "Submit 2", submit: true, saveInto: { if( isnull(local!data1), {}, /* do nothing */ a!save(local!value1,"test") ), if( isnull(local!data2), {}, /* do nothing */ a!save(local!value2,"test") ) } ) } ) )
example of the goal:
a!localVariables( local!data: if( rule!LEGO_IsEmpty(excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {3}, rowNumbers: {20})), 'type!{urn:com:appian:types:BTR}BTR_E_1'(), a!localVariables( local!data: updatedictionary(local!type, { cas101: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {3}, rowNumbers: {20}), cas201: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {5}, rowNumbers: {20}), cas301: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {7}, rowNumbers: {20}), cas401: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {8}, rowNumbers: {20}), cas601: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {12}, rowNumbers: {20}), cas202: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {17}, rowNumbers: {20}), cas302: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {20}, rowNumbers: {20}), } ), if() ) ), local!data )
If I am understanding you reqs right, it might be easier to have successive local variables:
a!localVariables( local!isDataANull: rule!LEGO_IsEmpty(excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {3}, rowNumbers: {20})), local!dataA: if(local!isDataANull, 'type!{urn:com:appian:types:BTR}BTR_E_1'(), updatedictionary(local!type, { cas101: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {3}, rowNumbers: {20}), cas201: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {5}, rowNumbers: {20}), cas301: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {7}, rowNumbers: {20}), cas401: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {8}, rowNumbers: {20}), cas601: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {12}, rowNumbers: {20}), cas202: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {17}, rowNumbers: {20}), cas302: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {10}, columnNumbers: {20}, rowNumbers: {20}), } ) ) ), local!dataB: if(or(isnull(local!isDataANull), isnull(/*your other condition)), null, rule!yourLogicRuleForDataB) ), /*Do Something with local DataB*/ )
I have chaged the code a little bit, so basicaly in this loop let's say if on 4th iterration lecalid is null than the loop should stop.
a!localVariables( local!countB: {30,31,32,33,34,35,36,37,38,39,40,41,42,42,44}, local!data: if( rule!LEGO_IsEmpty(excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {2}, rowNumbers: {30})), 'type!{urn:com:appian:types:BTR}BTR_H1_1'(), a!forEach( items: local!countB, expression: 'type!{urn:com:appian:types:BTR}BTR_H1_1'( id: fv!index, legalId: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {2}, rowNumbers: {fv!item}), name: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {3}, rowNumbers: {fv!item}), address: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {6}, rowNumbers: {fv!item}), percentage: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {9}, rowNumbers: {fv!item}), position: excelreadcellsbynumber(excelDoc: ri!document, sheetNumbers: {11}, columnNumbers: {10}, rowNumbers: {fv!item}), ) ) ), local!data )
If you only need to use the Excel Tools plugin, look into running this expression within a process model instead of an RPA robotic process
hello Danny, this is being executed inside expression rule once the data is calculated is being passed to the RPA. Replicating this in Process will generate many nodes not sure it this will be optimal.