Is it possible to re-use of Blob format in acumatica.(E.g:Data.uploadfilerevision table). If So, How?
Are you asking how to upload / download a file?
Yes, it's possible to reuse the Blob format in Acumatica, and there are many use cases where you might want to do so, such as handling file attachments, images, or any binary data. You can use the UploadFileRevision
table as a reference.
Here is an example of how you can work with Blob data in Acumatica:
- Defining a DAC Field for Blob Data In your DAC, you need a field to hold the Blob data. You can define it like this:
public abstract class blobData : PX.Data.BQL.BqlByteArray.Field<blobData> { }
>PXDBBinary]
public virtual bytee] BlobData { get; set; }
Here, PXDBBinary
is used to store binary data, such as a Blob.
- Uploading Blob Data To upload Blob data, you can use a file input element in your ASPX page. Here's an example:
<px:PXFileUpload ID="fuBlobData" runat="server" DataField="BlobData" />
-
Saving Blob Data To save Blob data, you usually don't need to do anything special in your graph since the data binding and the ORM will handle it. When you press the Save button, the data from the
PXFileUpload
control will be bound to your DAC field, and it will be stored in the database when the record is saved. -
Downloading Blob Data If you want to allow users to download the Blob data, you can use the
PXRedirectToFileException
class. For example:
public PXAction<YourDAC> downloadBlobData;
>PXButton(CommitChanges = true)]
>PXUIField(DisplayName = "Download Blob Data")]
public virtual IEnumerable DownloadBlobData(PXAdapter adapter)
{
var currentRecord = YourView.Current;
if (currentRecord != null && currentRecord.BlobData != null)
{
var file = new FileInfo("filename.extension", null, currentRecord.BlobData);
throw new PXRedirectToFileException(file, true);
}
return adapter.Get();
}
When the user clicks the "Download Blob Data" button, the Blob data will be downloaded to their computer with the specified filename and extension.
- Reusing
UploadFileRevision
Table If you want to reuse theUploadFileRevision
table for storing Blob data, you can do so. You can use theUploadFileMaintenance
graph to save and retrieve files and their revisions.
Please note that Blob data can be quite large, and storing a lot of it in your database can have performance implications. It's often a good idea to consider other storage options, such as file storage or cloud-based storage, especially for large-scale applications.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.