I know that I have to use the PONum to get to the PODetails table. I want to use the BTOOrder column to test if I want the checkbox hidden or not.
When I would code in a BPM, I would reference the db directly to get my data. But I’ve been reading on here that I should use an adapter, as this will all be client side. I’m having trouble finding an example of calling the adapter in the manuals in this context - the form I’m on (receipt) is not directly related to the table I need (PODetail). And I’ve never used an adapter before.
I’m also reading that I should not set the controls of the checkbox using “csm.GetNativeControlReference” like I would expect. Instead I should use the EpiDataview .ExtendedProperties[“IsHidden”]
Can someone confirm this?
And the other question is: Does someone have a good example of the adapter like I’m trying to do?
The Custom Object Explorer show me this:
using Erp.Adapters;
POAdapter [varAdapterName] = new POAdapter([UIForm]);
[varAdapterName].BOConnect();
// Get Property
PODetailDataTable [varName] = [varAdapterName].POData.PODetail;
[varAdapterName].Dispose();
I feel like I’m supposed to fill inside the brackets of new POAdapter([UIForm]); and replace UIFORM. But I’m not sure with what.
Help please.
I read through the steps of that and tried to apply it. I feel that how I need to evaluate the PO Detail is not simple enough.
I can choose “CustomCondition” for the Rule Condition and assume that I can evaluate on the POdetail. But the Rule Value is just showing a list of Constant that don’t seem to apply.
If you are just getting information, you can also use the dynamic query adapter to run a BAQ and get the information that you want. The full adapters like PO are more useful when you are trying to manipulate data because they handle the whole dataset for you. But I don’t think you need the whole dataset for this case.
Check out the thread below for how to call a query in code. Basically, you’ll make a BAQ that runs on parameters to get the information that you want, then you can call that query in code, then you use the results to set the visibility of your control.
This is good because the best way for me to evaluate my PODetail field is through aggregate. The BAQ does this nicely without C# code.
I’ll hammer on this route tomorrow.
Thanks!
This is a simplfied gist that would need some error handling etc.
Perhaps an even easier approach would be to create your own DataView (either BAQDataView or otherwise). You could have it driven off the selected RcvDtl record.
I would offer a Foreign Key View for POHeader and the a Sub Table View for PODetail. This would give you access to the field you need (no code).
Then a RowRule for hiding the checkbox.
Be aware that Foreign Key View uses GetByID method to get it’s data. In a context where there is not a lot of data returned it’s ok. But, in scenarios where it deals with Jobs (especially large jobs), the cost of getting a single value using FKV is TOTALLY to be avoided…the cost is too high.
I’m working on this, now. @Banderson 's way is the way I’m starting to try. Not to discount the input of the others. But I like working with the results of a BAQ for my aggregate result.
My BAQ gives me correct results with the input parameter.
And, as far as your circled part, that should be coming from something on in your dataview, a variable of some sort. Right now, you are just passing in the string “PONum” as your parameter. I’m guess you want to pass in the actual Po Number that is in the dataview. Right?
Side note, have you tried the extension that Jose made for visual studio code, or Visual studio? It’s worth the work to get it set up, because there are a lot of shortcuts that make this type of development go much much faster and less frustrating.
I think you have your code in the wrong place. If you go back to the original code that the wizard put in you should have that switch statement in there, and your code needs to go in that.