Hi folks, I noticed this is an age old question that has been responded to a few times. I did lookup those threads but their solutions seemed much more complicated than I needed.
My goal is to add a simple erp-file-box to the Customer screen and have it render in a box below it:
I tried to reverse engineer the parameters in the Company Maintenance which has a similar style logo input. I replicated the same settings, filters inputs etc. However I’m confused what the TransView is in the binding. It seems to be a transaction manager layer that converts the file to base64 to store in the db?
I’m missing a few steps to actually finish wiring this up and the documentation I’m finding is a bit confusing.
Why not use image maintenance? You can follow a naming convention of naming the image after the customer id or something. Then just display it in customer entry?
Definitely can, but supposedly Application Studio let’s us build fluid and meaningful UX experiences. There’s surely a way to make it work properly instead of a workaround?
@jbooker so I replicated how a Part Image works and I can get the search open, image selected and input changed in the field.
What I’m now struggling with is the picture box refreshing to actually load the relevant image. What actually tells the picture box to refresh itself to load the image content?
I have the picture boxes mapped to the exactly value of the fields. When they are populated they appear like so:
In the Part page I noticed that the picture box has an EpBinding of Image.ImageContent and I’m confused why that’s the case. I believe this is using the Image view and pulling the raw base64 representation of the value for the picture box field.
What I’m not understanding is how it knows what image field to use? Is that defined in the view itself?
Hmmm ok interesting. So the wizard created BO_Image_GetByID and BO_Image_GetNewImage as events. So I supposed I then need to use the BO_Image_GetByID and change the event to DataTable, Column Changed and mark the image? When I wire that up and select an image which populates the Logo_c column an error pops with Record not found.
I did see Set_Part_ImageID what I’m not understanding is when is that triggered? There’s no trigger set on it, so that runs every time? Also it’s calling Image.GetRows does that trigger the Image dataview which only grabs ImageIDs associated with my view?
The dataflow of App Studio is still not clicking for me. Coming from a front-end development perspective so this is definitely unique to me.
Oh also I actually have two separate image fields, do I need to pay attention to how I set them up? Part only has one image after all.
Nice job Dave. Only briefly looked at part image but I think the search box may be doing the work so it is no surprise the event chain is hard to folllow.
I believe you now have the objects in place to get this to work. Let’s take a step back and explain what your image selectors are doing now and then go from there.
For example, are you creating the image entry elsewhere and then using search to set logo_c to the image id? If so then next step is something like:
Create a new event, trigger onchanged of logo_c > event-next:BO_Image_GetById passing logo_c.
This should exec the BO and populate Image dataview with the Image row from ImageEntry when logo_c is changed. You can now bind the picture box component to Image.ImageContent
Like I said, I believe PartEntry may do this in onsearch event by copying the searchResult dataview to Image dataview. So the Image data may be populated automatically from search. I’m unclear what populates the image row initially when the imageid is already set on the part. It could be that search-value-set runs everytime. I beleive onchanged execs everytime as well. Let’s look into that technique if onchanged doesn’t do the trick for you.
As for the two images question, you could use two image DataViews or alter the get event to accept multiple imageids. Let’s cross that path once you have one picture box working.
You do not need to get the full image bytes yourself.
If you get the Image.ImageSysRowID value for your Uploaded Image and bind the Picture box to a field containing this. Then set your Picture box image type to fileStore then the system will get the image for you.