AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Acumatica Generic I...
Date Condition
 
Notifications
Clear all

Questions Date Condition

 
Acumatica Generic Inquiries & Pivot Tables
Last Post by Case Silva 7 years ago
14 Posts
4 Users
2 Reactions
9,576 Views
RSS
Taylan
Posts: 66
 Taylan
Topic starter
January 28, 2018 3:35 pm
(@taylan)
Estimable Member
Joined: 8 years ago

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.


13 Replies
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
January 29, 2018 2:07 am
(@timrodman)
Famed Member
Joined: 10 years ago

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?


Reply
Taylan
 Taylan
(@taylan)
Joined: 8 years ago

Estimable Member
Posts: 66
January 31, 2018 10:39 am
Reply toTim RodmanTim Rodman

I don't get any error messages. It is just the result page comes blank. I have tried the following formula to have a catch all, but still did not work.

=IIf( (DayOfWeek (Today())=6), DateAdd( Today(), 'd', -1), Today() )

When I use the same formula in the results tab, it works fine, but not in the conditions tab!

Thank you.


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
January 31, 2018 11:11 pm
(@timrodman)
Famed Member
Joined: 10 years ago

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.


Reply
Taylan
Posts: 66
 Taylan
Topic starter
February 1, 2018 9:54 am
(@taylan)
Estimable Member
Joined: 8 years ago

Thank you Tim.


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
February 1, 2018 6:25 pm
(@timrodman)
Famed Member
Joined: 10 years ago

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".


Reply
Taylan
Posts: 66
 Taylan
Topic starter
February 2, 2018 10:34 am
(@taylan)
Estimable Member
Joined: 8 years ago

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.


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
February 2, 2018 3:11 pm
(@timrodman)
Famed Member
Joined: 10 years ago

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.


Reply
Taylan
Posts: 66
 Taylan
Topic starter
February 2, 2018 3:35 pm
(@taylan)
Estimable Member
Joined: 8 years ago

Yes, I was using Left join. Gotta study joins again.

Thanks.


Reply
Tim Rodman reacted
Posts: 11
 Case Silva
September 20, 2018 4:39 pm
(@case-silva)
Member
Joined: 7 years ago

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.


Reply
Royce Lithgo
 Royce Lithgo
(@roycelithgo)
Joined: 5 years ago

Honorable Member
Posts: 557
September 20, 2018 11:25 pm
Reply toCase Silva

Simple - import restrictions on import scenarios don't support formulas. That's why there's no formula editor on any of the fields.

You could try @Today - it might work.

 


Reply
Posts: 11
 Case Silva
September 21, 2018 10:23 am
(@case-silva)
Member
Joined: 7 years ago

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?


Reply
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
September 26, 2018 5:27 am
(@timrodman)
Famed Member
Joined: 10 years ago

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.


Reply
 Case Silva
(@case-silva)
Joined: 7 years ago

Member
Posts: 11
September 26, 2018 9:34 am
Reply toTim RodmanTim Rodman

Thanks for the idea.  I'm hoping to not have to use an external file or program for this.  I might have to do that, though if there's no other way.  I went ahead and created my own question/forum topic in Import Scenarios for this since it's getting beyond the scope of the original question at this point.


Reply
Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,526 Topics
  • 10.9 K Posts
  • 15 Online
  • 2,324 Members
Our newest member: Michael Kiley
Latest Post: Pick List report suddenly not splitting on Shipment
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×