By using this website, you agree to our Terms of Use (click here)
Hi,
I have a GI which shows the total number of items shipped on a given day. I want it to switch to Friday if it is run on a Saturday or Sunday.
It works well when I set the condition of SoShipment.ShipDate to =DateAdd( Today(), 'd', -2 ), but it does not when I do =Switch (DayOfWeek( Today() )=1, DateAdd(Today(), 'd', -2)). I am not sure whether it has anything to do with Acumatica's sometimes showing dates as 01/28/2018 12:00:00.
Thank you.
What error message are you getting?
Have you tried adding another condition at the end of Switch as a catch all "what if nothing else matches true" condition?
Ah, so works on Results Grid, but not on Conditions huh?
Can you include a screenshot of your Conditions tab? For info on including a screenshot, click here.
Thank you Tim.
I just tried something similar and was able to get it to return some data. See screenshots below.
The only thing I'm not confirming is that records do indeed return when you are comparing ShipDate to the Today() function directly (the else part of your equation). If that's what is causing the problem in your situation, you might try doing something like DateAdd(Today(),'d',0) in case it returns a better format that can be compared to ShipDate than just plain Today(). Not sure if that explanation makes sense at all.
Also, you're probably just doing this for testing, but your logic seems to read, "if today is Wednesday, then give me all Monday shipments, otherwise, give me today's shipments".
Hi Tim,
I have had a few tables and relations and I guess that is what was causing the issue. Now I have less tables and the below formula works.
=IIf( DayofWeek(Today())=1 OR DayofWeek(Today())=6, Switch( DayofWeek(Today())=1, DateAdd( Today(), 'd', -2), DayofWeek(Today())=6, DateAdd( Today(), 'd', -1)), Today() )
The next time I have a similar issue, I will keep this, DateAdd(Today(),'d',0), in mind.
Thank you for your help.
Cool, glad you figured it out. Maybe you were using a Left join that returned a null. A null value would mess up the logic for sure.
Yes, I was using Left join. Gotta study joins again.
Thanks.
I was hoping that one of you might be able to give me a little more info about this. I see that using "=DateAdd( Today(), 'd', 0)" works fine as a condition in a Generic Inquiry. But, why does this not work as a Source Restriction for an Import Scenario? Attempting this same thing as a Source Restriction in an Import Scenario results in an error on Prepare that reads " Incorrect Syntax near 'd' ".
I need to schedule an Import Scenario as the second part of a two step process that runs early in the morning. The first part is working fine and creates entries in a database that has a date column with the date it was added. I need to the Import Scenario to only import entries that have columns matching that days date (i.e. the same as what =DateAdd(Today(), 'd', 0) does for the generic inquiry).
Is there something I'm missing here with this? Alternatively, is there a way to have an Import Scenario use a Generic Inquiry's results as a Data Provider object?
Thanks for any help you might be able to give.
Thanks for the suggestion. I gave that a shot and I don't get an error on Prepare anymore, but I also don't get any listings in the Prepared Data tab (Number of Records is 0 even though there should be some ready to import). What format does the @Today value return its info? My program creates the date in this sort of format:
09/21/2018
Does the @Today value shorten like "9/21/2018", or add anything like "09/21/2018 12:00:00"? Sorry for all the questions, I just can't find this info in the training documentation or through google searches.
Actually, I just retried the Generic Inquiry and replaced the =DateAdd(Today(), 'd', 0) with @Today and it worked the same. So, it seems like @Today also does not work for a Source Restriction in an Import Scenario. I guess that gets me back to my final thought of possibly using the results of a Generic Inquiry as the Data Source for the Import Scenario? Does that seem possible or any other options?
Generic Inquiry as a Data Source seems like an interesting idea, but I don't see Generic Inquiry listed in the Provider Type field on the Data Providers (SM206015) screen.
What you could do though is using Excel to connect to the Generic Inquiry via OData, then use the Excel file as your Data Provider.