Let me make your code a bit more readable. Next time, please use the </> button in the rich formatting view and try to arrange your code to be as clear as possible.
while select firstonly100 rent order by PostedDate desc where (rent.PostedDate > td && rent.RentalOrderStatus == z_RentalOrderStatus::Posted) || rent.RentalOrderStatus == z_RentalOrderStatus::Approved { info("orders"); }
QueryBuildRange range = this.query().dataSourceTable(tableNum(z_RentalOrderTable)).addRange(fieldNum(z_RentalOrderTable, RentalOrderStatus)); range.value(strfmt('(((%1 = %2) && (%3 > %4)) || (%1 = %5))', fieldStr(z_RentalOrderTable, RentalOrderStatus), any2int(z_RentalOrderStatus::Posted), fieldStr(z_RentalOrderTable, PostedDate), dateRange, any2int(z_RentalOrderStatus::Approved)));
What's the value of dateRange?