Solved

Select execution not working for financial period

  • 23 February 2023
  • 4 replies
  • 112 views

Userlevel 1
Badge

I want to find the financial period based on the date. Below is the code I have written but it feels something is wrong here. When I debug it says Model.cs not found when I execute view.SelectMulti.

Can anyone help me here. Below is the code snippet.

Filter is my own custom DAC for the filter.

var query = new SelectFrom<FinPeriod>.
Where<Filter.fromDate.FromCurrent.IsNull.Or<
Filter.fromDate.IsBetween<FinPeriod.startDate.FromCurrent, FinPeriod.endDate.FromCurrent>>>();
var view = new PXView(this, true, query);
var finPeriods = view.SelectMulti(null);

Thanks

icon

Best answer by Yuriy Zaletskyy 20 March 2023, 23:44

View original

4 replies

Userlevel 1
Badge

Anyone knows solution to this ??

Userlevel 5
Badge +3

In which graph, and which event you execute that? Which Acumatica build?

Userlevel 7
Badge

Hi @tanuj81  were you able to find a solution? Thank you!

Userlevel 5
Badge +3

Regarding error message Model.cs not found, additional context is needed. As Acumatica has more then one model class.

Overall, without context, which I asked you before,  I can suggest something like this:

 

    public class YourGraph : PXGraph<YourGraph>
{
public PXFilter<FinPeriodFilter> Filter;

public PXSelect<FinPeriod,
Where<FinPeriod.startDate, LessEqual<Current<FinPeriodFilter.fromDate>>,
And<FinPeriod.endDate, GreaterEqual<Current<FinPeriodFilter.fromDate>>>>> FinPeriods;

public virtual IEnumerable finPeriods()
{
FinPeriodFilter filter = Filter.Current;
if (filter != null && filter.FromDate != null)
{
foreach (FinPeriod period in PXSelect<FinPeriod,
Where<FinPeriod.startDate, LessEqual<Required<FinPeriodFilter.fromDate>>,
And<FinPeriod.endDate, GreaterEqual<Required<FinPeriodFilter.fromDate>>>>>
.Select(this, filter.FromDate, filter.FromDate))
{
yield return period;
}
}
}
}

public class FinPeriodFilter : IBqlTable
{
#region FromDate
public abstract class fromDate : PX.Data.BQL.BqlDateTime.Field<fromDate> { }

[PXDate]
[PXUIField(DisplayName = "From Date")]
public virtual DateTime? FromDate { get; set; }
#endregion
}

also question seems to be abandoned.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved