Jump to content
Salesforce and other SMB Solutions are coming soon. ×

multiple if expressions


boywonder
 Share

Recommended Posts

I want to do a calculation with multiple possibilities based on given conditions

 

If(WeekOfYear(HolidayStart) = WeekOfYear(CalendarDate);ImagesColour::gColorStripey;

If(WeekOfYear(HolidayStartNext) = WeekOfYear(CalendarDate);ImagesColour::gColorStripey;

If(WeekOfYear(HolidayStart3) = WeekOfYear(FromDate);ImagesColour::gColorStripey;

If(CalendarDate≤Staffing::CurrentProjectEnd;

Staffing::CurrentProject;

If(Staffing::NextProjectEnd

;ImagesColour::gColorYellow;

Staffing::NextProject)))))

 

The projects are coming through, and if there is no project currently allocated to the person, they are highlighted in yellow ... but the holiday stripes are not appearing ... I know its a simple part of the expression that I'm missing; any help appreciated.

 

thanks much

Link to comment
Share on other sites

I cannot understand this calculation. I see it tests conditions from five different fields against four other fields, and the results seem to be images and values. I think a nested if-statement stops evaluating at the first test that returns true. So the order of evaluations would be crucial. and/or in no circumstances should two tests be true at the same time. this seems hard to control in this case.

What are you trying to achieve?

 

kjoe

 

edited

Link to comment
Share on other sites

When considering a conditional that has multiple requirements you are almost always better off using the Case statement rather than the If.

 

The reason is that this function is much more efficient and works in the same manner as the If statement.

 

The simplicity of the Case statement makes it the best choice for multiple conditions.

 

While much can be accomplished with the multiple embedded If statements, they are not quite as efficient as the Case statement. The Case allows you to expand the number of conditions while reducing the overhead. Overhead is the extra Ifs and parentheses that are necessary when using multiple embedded If statements.

 

Once you understand that the functionality of the Case statement is exactly the same as an If statement, you may never need to use If in your calculations.

 

Only in ScriptMaker, since there is no Case available, the If step must still be used.

Link to comment
Share on other sites

Thanks for the input; the problem was embarassingly simple; the container field had lost its colour ... the calculation was doing exactly what I requested.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use