Is it possible to dynamically change the PXSelect a view is using programatically?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a button in which, when pressed, I want to show or hide rows in a grid based on certain criteria. Is it possible to change the PXSelect a view uses on the fly so that it re-queries the database and retrieves different results? I will, of course, be querying the same table and not changing up the structure of the View or grid.
acumatica
add a comment |
I have a button in which, when pressed, I want to show or hide rows in a grid based on certain criteria. Is it possible to change the PXSelect a view uses on the fly so that it re-queries the database and retrieves different results? I will, of course, be querying the same table and not changing up the structure of the View or grid.
acumatica
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38
add a comment |
I have a button in which, when pressed, I want to show or hide rows in a grid based on certain criteria. Is it possible to change the PXSelect a view uses on the fly so that it re-queries the database and retrieves different results? I will, of course, be querying the same table and not changing up the structure of the View or grid.
acumatica
I have a button in which, when pressed, I want to show or hide rows in a grid based on certain criteria. Is it possible to change the PXSelect a view uses on the fly so that it re-queries the database and retrieves different results? I will, of course, be querying the same table and not changing up the structure of the View or grid.
acumatica
acumatica
asked Nov 15 '18 at 17:30
EricP.EricP.
256214
256214
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38
add a comment |
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38
add a comment |
1 Answer
1
active
oldest
votes
The code below adds a non-visible field to the header record that is set by the button press this value is then used by the child records view delegate to determine based on the child records criteria (in this case a Boolean on each child) if they are shown.
public sealed class APInvoiceExtension : PXCacheExtension<APInvoice>
#region UsrShowAll
public abstract class usrShowAll : IBqlField
[PXBool]
public bool? UsrShowAll get; set;
#endregion
public sealed class APTranExtension : PXCacheExtension<APTran>
#region UsrHidden
public abstract class usrHidden : IBqlField
[PXDBBool]
[PXUIField(DisplayName = "Hidden", Enabled = false)]
public bool? UsrHidden get; set;
#endregion
public class APInvoiceEntryExtension : PXGraphExtension<APInvoiceEntry>
public PXAction<APInvoice> SHW;
[PXUIField(DisplayName = "Show All Records", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXButton]
protected void sHW()
if (Base.Document.Current != null)
APInvoiceExtension docExt = Base.Document.Current.GetExtension<APInvoiceExtension>();
docExt.UsrShowAll = !(docExt.UsrShowAll ?? false);
protected virtual IEnumerable transactions()
bool showAll = Base.Document.Current != null ? (Base.Document.Current.GetExtension<APInvoiceExtension>().UsrShowAll ?? false) : false;
APTran tran;
foreach (PXResult<APTran, POReceiptLine> res in Base.Transactions.Select())
tran = res[0] as APTran;
if (!showAll)
if (!(tran.GetExtension<APTranExtension>().UsrHidden ?? false))
yield return res;
else
yield return res;
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324955%2fis-it-possible-to-dynamically-change-the-pxselect-a-view-is-using-programaticall%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The code below adds a non-visible field to the header record that is set by the button press this value is then used by the child records view delegate to determine based on the child records criteria (in this case a Boolean on each child) if they are shown.
public sealed class APInvoiceExtension : PXCacheExtension<APInvoice>
#region UsrShowAll
public abstract class usrShowAll : IBqlField
[PXBool]
public bool? UsrShowAll get; set;
#endregion
public sealed class APTranExtension : PXCacheExtension<APTran>
#region UsrHidden
public abstract class usrHidden : IBqlField
[PXDBBool]
[PXUIField(DisplayName = "Hidden", Enabled = false)]
public bool? UsrHidden get; set;
#endregion
public class APInvoiceEntryExtension : PXGraphExtension<APInvoiceEntry>
public PXAction<APInvoice> SHW;
[PXUIField(DisplayName = "Show All Records", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXButton]
protected void sHW()
if (Base.Document.Current != null)
APInvoiceExtension docExt = Base.Document.Current.GetExtension<APInvoiceExtension>();
docExt.UsrShowAll = !(docExt.UsrShowAll ?? false);
protected virtual IEnumerable transactions()
bool showAll = Base.Document.Current != null ? (Base.Document.Current.GetExtension<APInvoiceExtension>().UsrShowAll ?? false) : false;
APTran tran;
foreach (PXResult<APTran, POReceiptLine> res in Base.Transactions.Select())
tran = res[0] as APTran;
if (!showAll)
if (!(tran.GetExtension<APTranExtension>().UsrHidden ?? false))
yield return res;
else
yield return res;
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
add a comment |
The code below adds a non-visible field to the header record that is set by the button press this value is then used by the child records view delegate to determine based on the child records criteria (in this case a Boolean on each child) if they are shown.
public sealed class APInvoiceExtension : PXCacheExtension<APInvoice>
#region UsrShowAll
public abstract class usrShowAll : IBqlField
[PXBool]
public bool? UsrShowAll get; set;
#endregion
public sealed class APTranExtension : PXCacheExtension<APTran>
#region UsrHidden
public abstract class usrHidden : IBqlField
[PXDBBool]
[PXUIField(DisplayName = "Hidden", Enabled = false)]
public bool? UsrHidden get; set;
#endregion
public class APInvoiceEntryExtension : PXGraphExtension<APInvoiceEntry>
public PXAction<APInvoice> SHW;
[PXUIField(DisplayName = "Show All Records", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXButton]
protected void sHW()
if (Base.Document.Current != null)
APInvoiceExtension docExt = Base.Document.Current.GetExtension<APInvoiceExtension>();
docExt.UsrShowAll = !(docExt.UsrShowAll ?? false);
protected virtual IEnumerable transactions()
bool showAll = Base.Document.Current != null ? (Base.Document.Current.GetExtension<APInvoiceExtension>().UsrShowAll ?? false) : false;
APTran tran;
foreach (PXResult<APTran, POReceiptLine> res in Base.Transactions.Select())
tran = res[0] as APTran;
if (!showAll)
if (!(tran.GetExtension<APTranExtension>().UsrHidden ?? false))
yield return res;
else
yield return res;
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
add a comment |
The code below adds a non-visible field to the header record that is set by the button press this value is then used by the child records view delegate to determine based on the child records criteria (in this case a Boolean on each child) if they are shown.
public sealed class APInvoiceExtension : PXCacheExtension<APInvoice>
#region UsrShowAll
public abstract class usrShowAll : IBqlField
[PXBool]
public bool? UsrShowAll get; set;
#endregion
public sealed class APTranExtension : PXCacheExtension<APTran>
#region UsrHidden
public abstract class usrHidden : IBqlField
[PXDBBool]
[PXUIField(DisplayName = "Hidden", Enabled = false)]
public bool? UsrHidden get; set;
#endregion
public class APInvoiceEntryExtension : PXGraphExtension<APInvoiceEntry>
public PXAction<APInvoice> SHW;
[PXUIField(DisplayName = "Show All Records", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXButton]
protected void sHW()
if (Base.Document.Current != null)
APInvoiceExtension docExt = Base.Document.Current.GetExtension<APInvoiceExtension>();
docExt.UsrShowAll = !(docExt.UsrShowAll ?? false);
protected virtual IEnumerable transactions()
bool showAll = Base.Document.Current != null ? (Base.Document.Current.GetExtension<APInvoiceExtension>().UsrShowAll ?? false) : false;
APTran tran;
foreach (PXResult<APTran, POReceiptLine> res in Base.Transactions.Select())
tran = res[0] as APTran;
if (!showAll)
if (!(tran.GetExtension<APTranExtension>().UsrHidden ?? false))
yield return res;
else
yield return res;
The code below adds a non-visible field to the header record that is set by the button press this value is then used by the child records view delegate to determine based on the child records criteria (in this case a Boolean on each child) if they are shown.
public sealed class APInvoiceExtension : PXCacheExtension<APInvoice>
#region UsrShowAll
public abstract class usrShowAll : IBqlField
[PXBool]
public bool? UsrShowAll get; set;
#endregion
public sealed class APTranExtension : PXCacheExtension<APTran>
#region UsrHidden
public abstract class usrHidden : IBqlField
[PXDBBool]
[PXUIField(DisplayName = "Hidden", Enabled = false)]
public bool? UsrHidden get; set;
#endregion
public class APInvoiceEntryExtension : PXGraphExtension<APInvoiceEntry>
public PXAction<APInvoice> SHW;
[PXUIField(DisplayName = "Show All Records", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXButton]
protected void sHW()
if (Base.Document.Current != null)
APInvoiceExtension docExt = Base.Document.Current.GetExtension<APInvoiceExtension>();
docExt.UsrShowAll = !(docExt.UsrShowAll ?? false);
protected virtual IEnumerable transactions()
bool showAll = Base.Document.Current != null ? (Base.Document.Current.GetExtension<APInvoiceExtension>().UsrShowAll ?? false) : false;
APTran tran;
foreach (PXResult<APTran, POReceiptLine> res in Base.Transactions.Select())
tran = res[0] as APTran;
if (!showAll)
if (!(tran.GetExtension<APTranExtension>().UsrHidden ?? false))
yield return res;
else
yield return res;
answered Nov 18 '18 at 15:36
Joshua Van HoesenJoshua Van Hoesen
871724
871724
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
add a comment |
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
1
1
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
Sorry for the delay on response. I was working on a different project. This worked perfectly! Thank you!
– EricP.
Dec 17 '18 at 18:27
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324955%2fis-it-possible-to-dynamically-change-the-pxselect-a-view-is-using-programaticall%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
possible option could be to use a filter on the graph and have your view link to the filter current value. your button can set the filter current values and might show the correct results?
– Brendan
Nov 16 '18 at 19:35
Is there a good source of information to look into the PXFilter other than the information provided in the T### books?
– EricP.
Nov 19 '18 at 18:47
Joshua has posted an answer that should help. His answer uses a view delegate to limit the results. You should also be able to set your BQL in the view itself to use the filter (Current<MyFilter.field>) to get the same results.
– Brendan
Nov 19 '18 at 21:38