custom query repeater with form data

lawrence whittemore asked on August 8, 2019 22:37

i'm using a query repeater to get form data and have a file on the form but cannot figure out how to make a link to the file in the transformation. Thoughts?

Recent Answers


Juraj Ondrus answered on August 9, 2019 06:43

The bizform files are accessible to logged in users only. You may need to compose the URL in your transformation to have this format: /CMSPages/GetBizFormFile.aspx?filename=<FileGUID>.<extension>&sitename=<SiteCodeName> The file name is the file GUID since the files are stored on disk with the GUID as the name.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 9, 2019 16:00

that is what I was trying, but when i eval the file field it spits out this "a6b83009-a39b-4fa9-9862-3a78e4610e56.eps/int_nl_sm_v_p_blk_4cp_180206.eps" I tried Eval("file").Split("/")[0] to get the first part but i get an error on the site.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on August 12, 2019 08:28

What is the error you are getting?

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 19, 2019 14:28

sorry for the late response was on vacation this is the error [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=f0a07eb0-1bd2-4997-a586-f79536d4ebf3/CMS.Root/Followupmessage.ascx(6): error CS1061: 'object' does not contain a definition for 'Split' and no accessible extension method 'Split' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on August 19, 2019 14:30

The Eval method returns probably an object but the Split method can be applied on a string data type. Could you please try to cast it to string at first.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 19, 2019 15:21

trying this Eval("File").ToString().Split("/")[0] I get this error [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=05856e79-5742-4450-8d67-c96a57470017/CMS.Root/Followupmessage.ascx(6): error CS1503: Argument 1: cannot convert from 'string' to 'char'

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on August 19, 2019 16:57

Eval("File").ToString().Split('/')[0] This seems to work. Needed the single quotes. But i do get another error if I have this in the transformation twice. Eval("File").ToString().Split('/')[1] this what to pull the file name. [CMSAbstractTransformation.DataBind]: Index was outside the bounds of the array. I do have the whole line of code in an IfEmpty() but still get the error on the items that don;t have a file at all.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on August 21, 2019 07:20

If you want to cast the object using eval, you should use Eval< ReturnType > .
Anyway, I think I found an easier way how to link the file - using direct physical path link like this (I had to add extra spaces around "<" so it is not encoded):
< a href="~/< SiteName >/BizFormFiles/< %# Eval< string >("FileColumnName").Split('/')[0] % > " >Link< /a >

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.