logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
laskamano  
#1 Posted : Thursday, March 3, 2022 7:09:27 AM(UTC)
laskamano

Rank: Newbie

Groups: Registered
Joined: 6/15/2020(UTC)
Posts: 4
Jamaica

Hello everyone,

i have done in "Final script" and "cell script" for Download drill down is yet
but have some issue in cell nevigation script it cant download

note* * my path image for download is this string not base64
i not much knowledge in script



this my cell nevigation script

Code:

@using System.Data
@using System.IO
@using System.Text
@{
    NavigationLink link = Model;
    ResultCell cell = link.Cell;
    ReportModel model = cell.ContextModel;

    //Script executed for a script navigation...
    //Note that other assemblies can be used by saving the .dll in the Repository 'Assemblies' sub-folder...

    //Sample to return a file contained in a blob
    var helper = new TaskDatabaseHelper();
    var command = helper.GetDbCommand(model.Connection.GetOpenConnection());

    //Get employee ID value
    var path = link.Cell.ContextCurrentLine.FirstOrDefault(i => i.Element.ColumnName.EndsWith("id")).Value;
    command.CommandText = string.Format("select Path from sso.tb_r_file where id = {0}", path);
    using (var reader = command.ExecuteReader())
    {
        if (reader.Read())
        {
            //* images = link.Cell.Value.ToString(); //Name of the file containing the extension
            //link.ScriptResult = FileHelper.GetTempUniqueFileName(images);
           //* link.ScriptResult = FileHelper.GetTempUniqueFileName(images);
            //File.WriteAllBytes(link.ScriptResult,reader["photo"]);
            var images = link.Cell.Value.ToString(); //Name of the file containing the extension
            link.ScriptResult = FileHelper.GetTempUniqueFileName(images);
            //File.WriteAllBytes(link.ScriptResult,((byte[]) reader["Path"]));
            File.WriteAllBytes(link.ScriptResult,((byte[]) reader["Path"]));
            //File.WriteLine(link.ScriptResult,((byte[]) reader["Path"]));
            //File.ReadAllText(link.ScriptResult,((byte[]) reader["Path"]));
        }  
    }

    //The script will be executed for cell having the following initialization in a Cell Script: 
    //cell.AddNavigationFileDownload("Download" + cell.DisplayValue);
}





and response in query (MariaDB)


Code:


Path
_____
"E:/uploadperson/1139_23-02-2022_18-49-32/5. HPE.pdf"

Edited by user Thursday, March 3, 2022 7:12:49 AM(UTC)  | Reason: Not specified

epf  
#2 Posted : Friday, March 4, 2022 9:29:51 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Did you check the sample 05-Scripts\500-images - File Download
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.