Rosalie Posted September 25, 2015 Posted September 25, 2015 Hello All, I want to save and print my MAterials that are expiring for the next month; Below is the script but it doesn't work. Can you please help me improve and correct it. Enter Find Mode[] Set Field[Materials::Expiry Date,Month(Get(CurrentDate))+1 Perform Find[] Set Variable[$found;Value:Get(FoundCount)] If[$found>0] Set Variable[$Counter;Value:1] Loop Set Variable[$names & GetNthRecord(Materials::Materials Name;$counter) & "¶" Exit Loop If [$counter=$found] Set Variable[$counter;Value:$counter + 1] Show Custom Dialog [Expiring Materials for the next month" Attention!! "ATTENTION!!!! NEXT MONTH EXPIRING Materials\"; \ & $names" Go to Layout [Materials List View" (Materials)] Show All Records Save Record as Excel End Loop End If Thank you so much in advance Rose
bruceR Posted September 25, 2015 Posted September 25, 2015 "But it doesn't work" In what way doesn't it work? Please provide more meaningful description. Though one problem seems obvious: you perform a find; but then before exporting you show all records.
Rosalie Posted September 25, 2015 Author Posted September 25, 2015 (edited) Hi BruceR, Thank you for the reply. Its not working the sense that I I tried to put October 08, 2015 to my Expiry Date field When I click my Expired next month button, not showing anything and its not going to my List View Layout.. Edited September 25, 2015 by Rosalie
dwdata Posted September 25, 2015 Posted September 25, 2015 Is your field "Materials::Expiry Date" a DATE field?If so, you could calculate the next month's range like the following:Date ( Month(Get ( CurrentDate )) + 1 ; 1 ; Year(Get ( CurrentDate )) ) & "…" & Date ( Month(Get ( CurrentDate )) + 2 ; 0 ; Year(Get ( CurrentDate )) )I agree with Bruce. Your LOOP in your script does not make sense. You, in essence, do a FIND on the next months records and then destroy your original found set with the SHOW ALL step.Please post a sample file of your data structure and some decent sample data with a details description of what you are trying to achieve. Good chance someone nice will help you achieve your goal.Hope this helps!
bruceR Posted September 25, 2015 Posted September 25, 2015 (edited) Further, consider exactly what your find does. It searches a date field for the value 10. That is what month( get(currentdate))+1 returns. Edited September 25, 2015 by BruceR
Recommended Posts
This topic is 3346 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now