100! I win!
You can iterate thru the rows, find the correct one, and act upon it if needed. My suggestion was to look for RowMod = “A” since I think thats what your new row is going to be.
100! I win!
You can iterate thru the rows, find the correct one, and act upon it if needed. My suggestion was to look for RowMod = “A” since I think thats what your new row is going to be.
Can’t we look for the row where the unbound box and key1 match?
I think you could. You could also just explicitly validate each needed field on change. You’d get instant feedback
See previous 99 replies lol. That’s what I had done before I wanted this stupid lookup if not new junk.
edit: I suppose you mean put hard stops in instead of soft ones so I don’t rely on BPM for final validation.
Didnt @asmar do something similar Chris?
Seems like it, but I’ve slept since then.
Yes, if you use validating, it wont let you leave the field until its right, Ala the pain in the ass “A job number has not been entered” error
OK, I follow the logic for why. Ignoring Barts golden rule of client side is for ease of use, BPM is for security, How would I stop incomplete entries?
Yes it is but my assumption (maybe wrong) that the new merged data would be last…
Is it loading the data but in the wrong order?
If you using validating event, that’s taken care of for you I do believe
Your get new count check if statement is on the wrong adapter should be on the new one not on orig (my bad)
Isn’t the purpose of doing it that way so you can save before the form is complete? To check for duplicate keys?
So I changed that, and it will create a new one if nothing is in the form, (but make sure you don’t have the tab stops set wrong or you get hosed). And it will look up new ones. But if there are rows already loaded, it will not create a new row. It just clears the fields.
Got it, we just need to focus on the right record. The EpiDataViews sort is screwing with us…
No, its a general event for controls. It basically says if you change the value, validate it - if it is not valid, you are brought back into the control to correct it
I’ll have to take a look at the validation event. The example It looks like it’s triggering on save right? Is there a reason that this is better than a BPM? If I’m reading you right, you are talking about putting on the field change instead right? And we would be doing that in order to save prior to field validation, right (for sake of checking for duplicate keys)? If I do that, how do I know that the entire form is filled out? If I only touch half of the fields, the half that I touch will be validated, but if someone doesn’t hit the rest, then they won’t be validated.
So I have a couple of different things going on in my head here.
The first one is this:
So new approach that I’m wondering about possibilities. The state that the screen is is when you have a freshly cleared screen would be exactly what I would want, except I want to keep the other items in the tree. Is it possible to trigger that state with a button so instead of new, or clear, I hit this a new button that triggers a “check if new” state that works just like the freshly cleared screen?
You can see below, the only fields available are the key fields, everything else is grayed out. When you put something into key1 and tab out, it either looks up the existing, or asks if you want to make a new record. Pretty much what I want, and I can’t get this to work the way I want it, will simply train the workers to use the clear screen instead of new, and they lose their history.
Second thing that I have going on.
This block of code is looking at the data view right? If we are merging the original adapter with the new one, we will have more that one row, so the get new is only going to work if there are no existing rows over there on the tree. So what we need to check for is whether or not the unbox box matches any of the key1’s in the data set right? If if matches, load that row, if it doesn’t make a new record. That’s what I think @Chris_Conn was getting at with iterating through the rows. So do that, is this a foreach loop? check for a match and if it finds one, load that row into the screen and if it doesn’t prompt for new?
//Get a hold of my current data virew
EpiDataView edv10 = oTrans.Factory("UD10");
//Select the "last" row in my data view as my current record
edv10.Row=ud10Adapter.UD10Data.UD10.Count-1;
//If I didn't find anything prompt for a new one
if(ud10AdapterOrig.UD10Data.UD10.Rows.Count<=0)
@Aaron_Moreng I’m trying to duplicate what was done here, and I’m getting a compile error. Any advice?
The Error is: Error: CS0246 - line 89 (417) - The type or namespace name ‘PartAdapter’ could not be found (are you missing a using directive or an assembly reference?)
Line 89 of the code is: PartAdapter adapterPart = new PartAdapter(oTrans);
You need to bring in the PartAdapter
add at the top of the code
using Erp.Adapters;
Perfect, Thanks!