Dynamic report name

Discussion forum about all things TD Mobile.
FRBhote
India
Posts: 130
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Dynamic report name

Post by FRBhote » 07 Sep 2018, 08:24

I have an app which prints bills. Several users will access the same database. However different users want their logo on the bill.

Apparently I cannot do that.

1. Images in the RPX are static.
2. The RPX file name is static - unlike SalReportPrint( hWndForm, sRepName, sVars, sInput, 0, RPT_PrintAll, 0, 0, nErr )

Would genuinely appreciate any ideas on how to go about it.

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 155
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Dynamic report name

Post by Igor Ivanovic » 07 Sep 2018, 08:39

Feroz,

AFAIK images are not static, you can assign a variable with a string containing the file name, or an object to it.
Take a look at IslandReport/IslandDemo.apx sample in you samples folder.
You have a EmployeeSalaryReport.RPX using both methods.

HTH
Igor Ivanovic
Image

fausto.lupercio
Ecuador
Posts: 10
Joined: 18 Sep 2017, 15:38
Location: Quito

Dynamic report name

Post by fausto.lupercio » 07 Sep 2018, 17:58

Hi,

You can put the logo in the database and dynamically obtain the logo in a variable, then sends it to the report as an object.

Thanks.
Fausto.

FRBhote
India
Posts: 130
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Dynamic report name

Post by FRBhote » 08 Sep 2018, 04:47

Thanks! Let me try it out.

FRBhote
India
Posts: 130
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Dynamic report name

Post by FRBhote » 11 Sep 2018, 10:25

Been struggling. How does one convert the image (string) to binary?

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 155
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Dynamic report name

Post by Igor Ivanovic » 11 Sep 2018, 13:35

What are you trying to achieve?
Save a picture to database, or something else?
A little more info would be fine...
Igor Ivanovic
Image

FRBhote
India
Posts: 130
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Dynamic report name

Post by FRBhote » 12 Sep 2018, 12:46

A picture can be used in a report (PDF) if it is in binary.

The statement which fetches a string in binary in Sqlserver is:

SELECT CAST(N' ' as xml).value('xs:base64Binary(sql:column(\"M_IMAGE\"))', 'varbinary(max)') INTO...

Unfortunately this does not work in TDM. A defect has been logged today as:

Defect number TD-24174
Using this table
CREATE TABLE BULL ( M_IMAGE VARCHAR(MAX) )

With this select statement
Set sSelect = "SELECT CAST(N' ' as xml).value('xs:base64Binary(sql:column(\"M_IMAGE\"))', 'varbinary(max)') FROM BULL INTO :S"

Will give the error "Incorrect syntax near ''.
The issue does not show using TD WIN32 native router and OLEDB


I need to convert the string into binary.

a_sivababu
India
Posts: 55
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Dynamic report name

Post by a_sivababu » 13 Sep 2018, 01:02

TDM is supporting SalStringToBinary() and SalBinaryToString() but this won't do base64 conversion I feel. I think we should create a C# function for that. However I generally create a stored function in SQL Server or Views for this kind of database dependent syntax since I use multiple databases.

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 155
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Dynamic report name

Post by Igor Ivanovic » 14 Sep 2018, 08:26

This explains your problem, as it's a bug in the router implementation for SqlServer.

TDM2.2 is almost ready for production, as it seems to me, maybe it's fixed in it.
I am receiving a lot of Defect-resolved statuses on the TDM issues I opened, so you should check if the status of the TD-24174 is resolved.
If not, the workaround a_sivababu suggested could be the resolution for your problem.
Igor Ivanovic
Image

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests