August 19, 201015 yr I need script advice. I am creating an expense report database. Part of my layout includes the following information – Start date End date Number of Days (calculating end date - start date) Per Diem Rate City Each days per diem needs to be itemized so I need to create a record in a portal for each day that includes the date, rate & city. Any ideas? Thanks in advance!
August 19, 201015 yr Each days per diem needs to be itemized Are you sure you need this? All it does is duplicate existing data and create room for possible discrepancy. BTW, shouldn't it be end date - start date + 1?
August 19, 201015 yr Author Yes, each day needs it's own per diem entry (bookkeepers orders), only the date is different. I forgot to mention the +1 but it's in the calculation. Any thoughts on how to accomplish this? I'm stuck.
August 19, 201015 yr Author Problem solved. I couldn't figure out how to loop the script so I just created a maximum # of days possible & created a really long script full of Set Field steps.
August 19, 201015 yr Sorry, I missed your earlier reply. So how about: Set Variable [ $parentID ; Parent::ParentID ] Set Variable [ $start ; Parent::Start Date ] Set Variable [ $n ; Parent::Number of Days ] Set Variable [ $rate ; Parent::Per Diem Rate ] # DELETE RELATED RECORDS, IF PREVIOUSLY CREATED If [ not IsEmpty ( Child::ParentID ) ] Go to Related Record [ Child ; Show related only ] Delete All Records Else Go to Layout [ Child ] End If Loop Exit Loop If [ not $n ] New Record Set Field [ Child::ParentID ; $parentID ] Set Field [ Child::Date ; $start ] Set Field [ Child::Rate ; $rate ] Set Variable [ $start ; $start + 1 ] Set Variable [ $n ; $n - 1 ] End Loop
Create an account or sign in to comment