Home > Forum > Forms > merge attachments

merge attachments
0

Hi,
is it possible, to use the action 'mergeattachment' not only for attachments in ONE form but also in DIFFERENT forms?

If not, is it possible via sql?
In the attached picture there is a screenshot of the following sql-query of the webcon-database:

select ATF_WFDID, ATF_OrginalName, ATF_OrginalValueHash from dbo.WFAttachmentFiles
where ATF_WFDID > 9620

how can I export the word-docs as real word-docs to the filesystem of the server?

Greetings
Franz Mayer

Dear Franz,
could you please confirm whether you’d like to download / save all attachments returned by your SQL query as the original files?
If that’s the case, this article by Kamil Nędza might help you build a query that saves attachments directly to a specified path:
https://alterpaths.com/attachments-export-from-the-webcon-bps-database/

Hope this helps.

MVP

Hi Franz,

if you use the SQL query in the Merge Attachments action you are free to select whatever attachments you want.

https://docs.webcon.com/docs/2025R1/Studio/Action/Attachments/Action_MergeAttachments#4-sql-query

I haven't checked the latest 2025 Version but in the 2026 R1 version the issue is fixed, that the order of the SQL query has been ignored during the merge process.,

If you want to save the files from the database on a hard drive, I would use PowerShell. This would be a part of the solution

___
The query to get all relevant files and their length
___

___
Iterating over the result set
___
$fileLength = $row.FileLength

$fileContentQuery = @"
SELECT TOP 1 ATF_Value
FROM [$AttachmentDatabaseName].[dbo].[WFAttachmentFiles]
WHERE ATF_ATTID = $attId
ORDER BY ATF_Version DESC
"@

$fileContentResult = Invoke-Sqlcmd -ConnectionString $ConnectionString -Query $fileContentQuery -MaxBinaryLength $fileLength
$fileContent = $fileContentResult.ATF_Value
____
Define the file path / name
____
[System.IO.File]::WriteAllBytes($filePath, $fileContent)