Is it possible to re-use of Blob format in acumatica.(E.g:Data.uploadfilerevision table). If So, How?
Best answer by davidnavasardyan09
View originalIs it possible to re-use of Blob format in acumatica.(E.g:Data.uploadfilerevision table). If So, How?
Best answer by davidnavasardyan09
View originalYes, 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:
public abstract class blobData : PX.Data.BQL.BqlByteArray.Field<blobData> { }
[PXDBBinary]
public virtual byte[] BlobData { get; set; }
Here, PXDBBinary
is used to store binary data, such as a Blob.
<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.
UploadFileRevision
Table If you want to reuse the UploadFileRevision
table for storing Blob data, you can do so. You can use the UploadFileMaintenance
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.
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.