Forum Index

No notifications
Notifications

Favorites

No favorites found
General Training Discussion General chat and comment on KnowledgeKube training
KnowledgeKube Training > General Training Discussion > Mapping Data Source Grid Image to a Link View modes: 
User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 22/09/2016 08:45:27
   
RE:Mapping Data Source Grid Image to a Link
Hi, Unfortunately this is a know issue with the current version of KnowledgeKube. It has been logged with the team and will be resolved in a future build, in the mean time you will have to use horizontal alignment by changing the VerticalAlignedColumns attribute value to false or unchecking the Vertical Aligned Columns checkbox under Options in the Datasource Grid Configuration. Thanks, Andy

User avatar
Advanced member
Advanced member
   
RE:Mapping Data Source Grid Image to a Link
Hi, I already fixed it, some problems with the use of quotation marks on my parameters. My problem now is that the rows displayed vertically gets the wrong value from database. The first column of the first row gets the value of the first column of the last row of my database. What are the modifications do I need to make on my Data Source Grid? Thanks!

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 21/09/2016 11:50:11
   
RE:Mapping Data Source Grid Image to a Link
Hello, Could I see the expression from your Derived Column and also the format string you're storing in the Variable? Thanks, Andy

User avatar
Advanced member
Advanced member
   
RE:Mapping Data Source Grid Image to a Link
Hello, I tried using the Model Identifiers, both the link and image did not appear. And also tried the following: *Input quotation marks on the beginning and the end of the tags. *Changed the data:image;base64,{1}' to data:image/jpeg;base64,/{1} Any of the approaches that I have tried did not work too, is there a specific step to be followed? Thanks!

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 21/09/2016 09:47:57
   
RE:Mapping Data Source Grid Image to a Link
Hi, I've done a bit of an experimenting and found a way for this method to work with base 64 strings. The format string you will have to use is this:
However as this string contains a semi colon you will not be able to use this directly in a Derived Column without it causing an error, as semi-colons are used as line ending characters in KnowledgeKube expressions. If you add this string to the default value of a variable from the Model Identifiers window (Model>Sub-Models>Model Identifiers>Manage Identifiers or from the Model Identifiers icon on the toolbar) and then use the variable name in your FormatString function this should work correctly.
FormatString(VariableName, "LinkURL,ImageURL");
Thanks, Andy

User avatar
Advanced member
Advanced member
   
RE:Mapping Data Source Grid Image to a Link
Hello, I tried the second approach but the image is not rendered though the link url is working. My image is not based on ImageURL but in a base 64 string format. Thanks!

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 20/09/2016 12:11:02
   
RE:Mapping Data Source Grid Image to a Link
Hello, There are two approaches to this, the first is to use JavaScript to manipulate the grid. The second approach involves KnowledgeKube expressions and a little knowledge of HTML. There is a column type for data source grids called Derived Column which allows the results of an expression to be displayed for each row. A useful feature of KnowledgeKube is that any valid HTML in for example the Question Text of a Read Only Question or the result of a Derived Column will get rendered by a web browser. However, please be careful with how this is used as HTML will not render on Enterprise Server Models. If you include the image and link URLs in the data source grid you can use a Derived Column to combine these into a single HTML element using the FormatString function.
FormatString(StringFormat, VariableList);
FormatString allows you to take a number of variables and insert them into placeholders in a string, for example:
FirstName := "John";
LastName := "Smith";
FormatString("{0} {1}", "FirstName,LastName");
This would combine the values of FirstName and LastName into a single string with a space between ("John Smith"). The numbers between the { and } characters are the placeholders for the variables in the list using a zero-based index (the first item in the list is {0}, the second {1} and so on).
FormatString("", "LinkURL,ImageURL");
The expression above will take the two keywords LinkURL and ImageURL (keywords from your data source grid) and insert them into the format string, resulting in an image (ImageURL) that will go a webpage (LinkURL) when it is clicked. The "target=_blank" is optional but will make the link open in a new browser tab. Many Thanks, Andy

User avatar
Advanced member
Advanced member
   
Mapping Data Source Grid Image to a Link
Hello, Is there a way to link a Data Source Grid to a link? So that when the image was clicked it will redirect the user to an external or internal link. Thanks!

RSS Feed