Site Property

  
Hi,

I'm trying to pass a text variable into a site property. This variable can store a large amount of text. Because of this the resulting error message is "String or binary data would be truncated. The statement has been terminated." Do you know what is the maximum length allowed for a site property of type text?

Thank you for your help

Yuri
Why are you putting so much data into a site property? Especially from user input? That is a BIG red flag!

The max length is probably 2000 or 5000, if I had a guess.

J.Ja
Justin James wrote:
Why are you putting so much data into a site property? Especially from user input? That is a BIG red flag!

The max length is probably 2000 or 5000, if I had a guess.

J.Ja
 
 Hello Justin

You guess right.

Site Property values are stored in the database, and then can have up to 2000 unicode characters.

@Yuri, so if your Site Property value a text larger then 2000 characters this error would occur. Usually, for that kind of volume, binary type values are used, however, you cannot stored in a Site Property.

I would suggest an entity with a binary data attribute.

Cheers

Miguel Simões João
Hi Miguel,

Thank you for your quick reply.

The issue is that I need to pass an SQL query to generate a pdf. If I put it on a entity (which I understand it will work) that means that I need to read and write from the database every time I want to generate a pdf and I would think it would slow down the page.

Passing it as a variable in the URL causes the same problem.

Is there any other way of doing this?

Thanks again for your help.

Yuri
Yuri -

Site properties get stored in the database too, so you aren't saving any DB access. So do Session variables, so that won't be saving DB access either.

If you are dead set against having it in the DB (and really, pulling a few KB of data from the DB per request is NOT a big deal, especially compared to the time it will take to generate a PDF!), you could try to use a local page variable and set the value in that variable as a literal.

J.Ja
Yuri Melo wrote:
Hi Miguel,

Thank you for your quick reply.

The issue is that I need to pass an SQL query to generate a pdf. If I put it on a entity (which I understand it will work) that means that I need to read and write from the database every time I want to generate a pdf and I would think it would slow down the page.

Passing it as a variable in the URL causes the same problem.

Is there any other way of doing this?

Thanks again for your help.

Yuri
 

Hello Yuri

I'm not seeing the full picture here, so maybe my question may sound stupid, but why are you saving the SQL query on the Site Property (or Database) when you can put in a SImple Query (if it's over app datamodel) or advanced query?

Cheers

Miguel Simões João
 
Hi Justin,

If that is the case then it seems the best option! I guess that the entity will have to eventually get purged once I finished using it to avoid filling the table with temp garbage.

@ Miguel, I use the html to pdf solution from outsystems which required a url to be passed to this mechanism. Since the query is dynamic where the SQL "where" clause is set based on options previosuly selected by the user, I need to pass the clause line together with the URL that will generate the pdf. Since there are multiple options the user can select, then the size of the line is unpredictable and can indeed exceed the max length.

Does that make sense?

Yuri