Skip to content

Instantly share code, notes, and snippets.

@anaxetogrind
Last active November 23, 2021 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anaxetogrind/dc53fe2e62bfde79b9a36e0d26192818 to your computer and use it in GitHub Desktop.
Save anaxetogrind/dc53fe2e62bfde79b9a36e0d26192818 to your computer and use it in GitHub Desktop.
AppointmentInqFilterExt Example
public class AppointmentInqFilterExt : PXCacheExtension<PX.Objects.FS.AppointmentInq.AppointmentInqFilter>
{
#region UsrStatus
[PXString(1,IsFixed=true,IsUnicode = true)]
[PXDefault(usrStatus.Values.NotStarted)]
[usrStatus.Values.List]
[PXUIField(DisplayName="Status")]
public virtual string UsrStatus { get; set; }
public abstract class usrStatus : PX.Data.BQL.BqlString.Field<usrStatus> {
public abstract class Values : ListField.AppointmentStatus { } }
#endregion
}
public class AppointmentInq_Extension : PXGraphExtension<AppointmentInq>
{
//The method for adding the custom filter
private void FilterMore(ref BqlCommand query, AppointmentInqFilterExt filterExt)
{
if(filterExt.UsrStatus != null)
{
query = query.WhereAnd<Where<Current<AppointmentInqFilterExt.usrStatus>,
Equal<FSAppointmentFSServiceOrder.status>>>();
}
}
// The delegate for the DetailsView data view
protected virtual IEnumerable appointments()
{
int startRow = PXView.StartRow;
int totalRows = 0;
var filter = Base.Filter.Current;
var filterExt = filter.GetExtension<AppointmentInqFilterExt>();
BqlCommand query = Base.Appointments.View.BqlSelect;
FilterMore(ref query, filterExt);
PXView view = new PXView(Base,true,query);
var list = view.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
PXView.SortColumns, PXView.Descendings, PXView.Filters,ref startRow,PXView.MaximumRows,ref totalRows);
PXView.StartRow = 0;
return list;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment