last day (21 days later) » 

4:32 PM
1
A: Update Selector selection with another Selector's selected value

BrendanYou just need to set the selector to use Current and point to the Dac/Field used in your header the same way you do a view in a graph. [PXSelector(typeof(Search<TableTwo.someOtherField, Where<TableTwo.someRelatedField, Equal<Current<HeaderTable.relatedField>>>))] In your page file on your ...

 
For a PXSelector inside of a grid, how do I set AutoRefresh = true? I don't see the option in the Layout Editor, and when I attempt to edit the ASPX, I get the error "Validation (ASP.Net): Attribute 'AutoRefresh is not a valid attribute of element 'PXGridColumn'." This is my ASPX line for that specific selector: <px:PXGridColumn CommitChanges="True" DataField="PrimaryReasonId" Width="70" /> <px:PXGridColumn DataField="SecondaryReasonId" Width="70" <!--Refresh here -->/> It isn't a typical PXSelector for me because it belongs to a grid.
 
it doesn't go on the grid column, it goes in the RowTemplate in the PXSelector tag. Typically each column in a grid has two entries within PXGrid (one under "RowTemplate" and one under "Columns"). Look at the sales order page for example (SO301000) and search for "UOM" in the Document Details tab. It is a PXSelector with AutoRefresh="True"
 
I was able to get the RowTemplate created, so now I have: <RowTemplate> <px:PXSelector AutoRefresh="True" runat="server" ID="CstPXSelector78" DataField="PrimaryReasonId" CommitChanges="True" ></px:PXSelector> <px:PXSelector CommitChanges="True" AutoRefresh="True" runat="server" ID="CstPXSelector79" DataField="SecondaryReasonId" ></px:PXSelector></RowTemplate> However it is still not updating the second selector. Is it OK that the second selector is in the same DAC as the first selector, or do they need to be contained in seperate DACs?
 
They can be in the same DAC as the current just points to the correct Table.Field. I thought the selectors are in 2 separate tables as you mentioned a value gets set in the header (table 1), which the detail (table 2) then looks at the header value? Or is the same table/DAC used in both the header and detail?
 
Sorry for the confusion. The Header and Detail are separate tables, but I have a third table/DAC in which they will both belong as well. The user will pick a header selection, and then a detail selection which will then be stored together in this third table (along with other information). I have the third DAC set up to populate the first selector based on the Header table, then the second selector populates based on the Detail table and filtered by the current selection of the first selector. Sorry if this sounds confusing.
I think my issue has something to do with the second selector. Even when I save the entry and reload the page, SQL is never getting a request to populate the Secondary selector. If you don't mind, I'd like to use the chat feature and link my code to do on how I have the DAC set up to see if there is an issue there that you might be able to see. Let me know if you are available to do this. Thanks.
 
4:32 PM
not sure how to chat in stackoverflow. Can you include the 2nd selector in the original question?
 
Hello Brendan, this is the chat
 
nice. never knew this existed
 
Thanks for assisting me on this. I'll go ahead and post my DAC
 
sound good
 
I'mgoing to just post the parts that are directly related to my issue:
#region PrimaryReasonId

[PXDBString(10, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Primary Reason")]
[PXSelector(typeof(Search<EMPPrimaryReasonCode.id>), typeof(EMPPrimaryReasonCode.reasonCode),
typeof(EMPPrimaryReasonCode.description), SubstituteKey = typeof(EMPPrimaryReasonCode.reasonCode))]
public string PrimaryReasonId { get; set; }

public class primaryReasonId : IBqlField { }

#endregion


#region SecondaryReasonId

[PXDBInt()]
[PXUIField(DisplayName = "Secondary Reason")]
The Primary and Secondary reason codes are stored in their own table. This DAC is a table that links them together and associates them to a Work Order, so the third table is a detailed relation table in a sense
 
4:34 PM
so you mentioned even after you refresh your page and try the selector again it does not work (nothing displayed)?
 
Correct, and I don't see a request in my SQL Server Profiler
 
can you post the aspx page entries for the 2nd field again?
 
sure
<RowTemplate>
<px:PXSelector AutoRefresh="True" runat="server" ID="CstPXSelector78" DataField="PrimaryReasonId" CommitChanges="True" ></px:PXSelector>
<px:PXSelector CommitChanges="True" AutoRefresh="True" runat="server" ID="CstPXSelector79" DataField="SecondaryReasonId" ></px:PXSelector></RowTemplate>
That's just the RowTemplate. Do you want the entire PXGrid?
 
no that is fine
is EMPWorkOrderLateReason in a view on the graph?
 
it is the DAC's name
 
4:39 PM
i assume yes if it is in the header?
 
oh wait, sorry sec
yes I believe it is
 
yes. but i assume it is being it is the header?
 
let me doubel check
 
where is EMPWorkOrderLateReason in the page?
the header?
 
Oh no... That may be my issue...
 
4:40 PM
here is something to try.... in PXGrid make sure SyncPosition="True" exists
 
<px:PXGridLevel DataMember="LateReasons" >
 
again look at SO301000 for that keyword and its use
 
Oh wait never mind.,.
    public PXSelect<EMPWorkOrderLateReason, Where<EMPWorkOrderLateReason.woid, Equal<Current<EMPWorkOrder.id>>>> LateReasons;
this is my View using EMPWorkOrderLateReason for the page
Ok, I just set SyncPosition as true and will test with that
 
sounds good
 
Nope, still showing blank on second selector
 
4:43 PM
do you have a screen shot of what this page looks like and maybe indicate the selector placements and relationships with arrows?
 
Sure I can make one, give me a second
 
sure
 
Not sure if I can send a picture over this chat, but I can link to imgur
 
yea that works
actually i do see an upload button...
to the right of the chat message box and send button
 
oh, hmm let me see
I don't see it, sorry
 
4:49 PM
its ok. i can see your image... thinking...
EMPSecondaryReasonCode.primaryReasonCode, EMPWorkOrderLateReason.primaryReasonId
Just making sure this match up is the same. I see you have ID vs Code as a substitute key. Should they both be some type of reasonID? The SQL might not be hit depending on the values cached from previous use
but i think typically the selector would hit sql on the first use
should it be something like this?...
EMPSecondaryReasonCode.primaryReasonId, EMPWorkOrderLateReason.primaryReasonId
 
I did try removing the Substitute key just in case of that, but there wasn't any change. The thing is I have an auto numbering system in place for IDs, but I made a second entry for an actual human user code for each of the entries, thus it displays the human code instead of the ID
The primaryReasonCode is basically the primaryReasonId
 
ok. just making sure. Can you confirm the selector works if you remove the where statement? We can also make a constant with the value of a primary value and fix it into the selector to confirm everything else with the selector is working (that it is just having problems getting the current value). So lets try this...
 
I did just notice I have those named differently when they should probably match. That could be confusing, but yes the EMPSecondaryReasonCode.primaryReasonCode stores the PrimaryReasonCodeId
 
so add this in the graph or anywhere accessible...
public class testReasonCodeId : Constant<int>
{
public testReasonCodeId() : base(123) { ;}
}
replace the value "123" with a valid primary reason code id
then replace your selector like this...
Search<EMPSecondaryReasonCode.id, Where<EMPSecondaryReasonCode.primaryReasonCode, Equal<testReasonCodeId>>
basically jsut remove the current<> and add in your constant. Lets just see if the selector will work with a fixed primary ID
 
alright, testing
 
5:01 PM
ok
 
nope, got nothing. Even tried removing the Where clause completely and still got nothing.
 
ah ok so this would tell me its more than just the selector... (thinking)
 
Yes, that's what I'm guessing at this point. What I don't understand is why there is no query made on page load to SQL to populate the second selector. I'm assuming I added the selector incorrectly.
 
we have a handful of screens with this scenario... let me review them real quick
 
I'm wondering if I am going to need a CustomSelectorAttribute
 
5:09 PM
no you should be ok
we have our transaction pages where we have field 1, field 2 (selector based on field 1), field 3 (selector based on field 1 and field 2)
and a few of these pages
and just normal selectors
what you are asking to do should be possible with what you have. Can you send me the entire page file?
your DAC seems fine
i will compare your page with some of my pages
 
you want the entire BLC?
 
you can, but right now just looking for the aspx
 
I've seen multiple pages that use selectors that influence the selections of other selectors, hence why I thought it wouldn't be a huge deal, but apparently... haha..
ok, sure
 
yea i would say what you have looks good
the only difference for my examples is I am not using substitute key
 
Well for this instance to get it working, I can remove the substitute key for the time being
getting that file for you... going to see if I can figure out how to send it via the chat, but if I can't I can upload to drop box if you don't mind
 
5:16 PM
that is fine. but walking back to something you mentioned earlier
you said if you take out the where statement it still doesn't work?
that would basically make it the same selector as the primary... just different table correct?
in the box where you type for this chat.... are there 2 buttons next to it?
i have a "send" and "upload" button
 
Correct, removing the where clause still did not send a request to the SQL server to populate the selector
 
ok looking at the page now
 
I just have a send. I wonder if it is a Stackoverflow privilege unlock thing... My score is still very low.
 
oh i think i found it
well let me ask...
i see primary reason id is a string, and secondary is an int? (looking at your data types for your dac). if that is not it... will keep looking at the page
 
Could it be because I'm using the same DAC for two different selectors that are directly related to each other?
yes, secondary is assigned as an int... I know my numbering system is not the best. I need to refactor it to more closely resemble how it is done on other pages, but currently I use a string and another DAC to autonumber IDs for most things.
 
5:23 PM
that should be ok
 
When I can, I use the database to auto number other objects
 
yea that works. its an easy feature to use (the autonumber)
let me compare this page to some of mine
 
sure
 
i see you are building out some type of work order feature is this a customer customization? or a sell-able product? (just curious)
 
customer customization
specific to their manufacturing needs
 
5:27 PM
nice
 
I'm actually taking an existing program their developer(s) made and directly implementing it into Acumatica itself. The process has gone smoothly for the most part, but there have been some rough patches, like this one, along the way
 
yea i would say Acumatica is very flexible and easy to customization... but when you get stuck it sucks. even more so when it seems like a easy task like this
i found one example where i use an int with substituekey...
 
Oh don't get me started, haha... It took me weeks to figure out how to successfully change the label of a field via CacheAttached
but at the same time it took me seconds to attach all of their notes/files/etc features they readily make available for all of their pages. Pros and Cons
 
yea... there is some learning to do up front... but it sounds like you are building out a big customization which is great for learning... i am sure by the end you can code this blindfolded :)
 
Hahaha not sure about THAT good, but I'm certainly learning a lot about the system.
 
5:39 PM
not sure that is necessary but one difference from my example is DataSourceID="ds" in PXSelector... try to add it in for both of your fields to see if it makes a difference

<px:PXSelector ID="edTargetFeatureLineNbr" runat="server" DataField="TargetFeatureLineNbr" AutoRefresh="True" DataSourceID="ds" CommitChanges="true">
</px:PXSelector>
otherwise it looks like a valid setup
make sure the compiled update removing the where statement is in place to just get the full list of records
 
ok, trying with the added DataSourceID
Nope, didn't work...
 
very stange
 
I'm wondering something. I sorta had the same issue with a grid and selector
 
and you said it didnt work if you removed substitute key?
are you positive your dll is making it where it needs to be? (change the label for example to confirm)
the label of the field that is
 
trying without substitute key now
oh wait i removed the wrong substitute key, whoops, sec
nope, didn't work
 
5:44 PM
i would also confirm by changing the display name. I have had issues where the dll stopped making it to the site bin folder and caused some headache. Changing the label should confirm it made it correctly
 
well.. That's interesting
I removed the "Reason" from both "Primary Reason" and "Secondary Reason" in the display name, and only the "Primary Reason" updated.... so now I have columns "Primary" and "Secondary Reason"
 
it sounds like something is out of wack for sure
do you have cache attached in your graph?
for the secondary reason?
as the graph cache attached will cover any changes made in the DAC
(i have had those bite me before)
 
ahhh yeah I do... oh no...
hahaha let me see if that has been overriding my changes, doh!!!
Facepalm...
That was it... whoops!
 
that solved it!
haha
 
I had a CacheAttached in there I forgot I put in and didn't realize it. It was overriding my changes
 
5:51 PM
big facepalm
haha
 
hahaha indeed
 
well it was good chatting anyway :)
 
Thanks a ton Brendan! I appreciate your time and help!
 
no problem. dont forget to update the post
 
Will do!
 
5:52 PM
have a good one
 
You too!
by the way, I think chat.stackoverflow.com is the way to access the chat rooms
just for future reference. Thanks again, cya around!
 
will try that next time. much better than commenting the conversation (and no one else cares to see it)
 

  last day (21 days later) »