Logical Expression for Editable List View

  • 23 September 2016
  • 3 replies
  • 5 views

Badge +4

I have an Editable list view with fields as below:

 

  1. ResourceType: {drop-down list} Values: Internal, External
  2. Hours: {Number field} - This stores hours

I would like to get a summation of Internal hours seperate then external hours. Currently I am just getting summation of all the hours but I need to break it down by Internal hours and External hours.

 

Basically, how do I use the following expression:

 

If ResourceType = Internal Add hours and store the value in a seperate field called - Total Internal Hours

 

I get List Sum (Hours) but how do I add If statement 


3 replies

Userlevel 3
Badge +10

Greetings @RanaSnehal,


 


I recently tried to create a similar solution involving List View aggregation with conditions using only expressions, but I was not able to find a way.  I believe the List View returns an array which can only be used in the List-based Inline Functions without conditions.  If anyone knows of a way to do this, please share.


 


I ended up using a For Loop condition, nesting my conditions under that, and using the Transfer Data action.  To increment a field, I created an expression in Layout mode, setting a Data Label to its own value +1, then Transfer Data putting that expression into the Data Label.  You could do the same, but instead of '1', use the SmartObject reference for the Hours field.  When using a SmartObject reference value in a For Loop, it refers to the value of that reference item in the current iteration of the loop.


 


Hope that wasn't too confusing.  Let me know if I can clarify anything.


 


Jonathan

Badge +4

Jonathan,

 

Could you post a sample to look at? Where did you apply the for loop?

Badge +4

I just figured it out. Not an ideal solution but it works:

 

  1. Removed the Resource type drop-down list. 
  2. Seperte out Interal hours and External hours.
  3. The existing hours field will hold the summation of Internal and External hours.
  4. Add column list summation to each Hours, Internal and External Hours columns

It would really help if we could figure out the conditional logic for drop-down list. Until then ....

Reply