Fetch criteria with "if" ?

Fetch criteria with "if" ?

Hi All,

I have a function that gets two variables: Date (date) and SectionName (string), fetch entries from a form by criteria based on those variables, and than makes a change in the entries.

The criteria always targets the "Date" field, and if "SectionName" var is not empty, it also targets "Section Name" field.

Currently, I have the same syntax run twice - once if SectionName != "" (meaning it's not null, and than the function use it as a filter) and second time for SectionName = "" (meaning it's empty, so the function only use the date as criteria).


Can I do something like

For Each EachEntry in FormName [ DateField = Date && (if SectionName != "" { SectionField = SectionName })
{
-take action-
}


?

Thanks

Ravid