#1 2016-10-11 14:25:40

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

How to concatenat URL with Record's attribute in Report's HTML editor?

How to concatenate URL with Record's attribute in Report's HTML editor?

For example:

<td>
<iframe src="http://www.baidu.com/?q=[Record.keyword]&i=[Record.pageIndex]" 
 width="100%" height="64px" frameborder="1"></iframe>
</td>

But the result is not what I expected.

Thanks a lot.

Offline

#2 2016-10-11 14:41:44

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello Zeng,

Yes; please, try by using "{{}}" for the variables instead "[]". Then your code must be something like that:

<td>
<iframe src="http://www.baidu.com/?q={{Record.keyword}}&i={{Record.pageIndex}}" 
 width="100%" height="64px" frameborder="1"></iframe>
</td>

Offline

#3 2016-10-11 14:55:18

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Thank you, David.

I've tried using "{{}}", AppBuilder report error in console:

Error: "[$interpolate:noconcat] [url=http://errors.angularjs.org/1.5.3/$interpolate/noconcat?p0=http%3A%2F%2Fwww.baidu.com%2F%3Fq%3D%7B%7BRecord.keyword%7D%7D]http://errors.angularjs.org/1.5.3/$interpolate/noconcat?p0=http%3A%2F%2Fwww.baidu.com%2F%3Fq%3D%7B%7BRecord.keyword%7D%7D"[/url] - Line: 296 - Char: 13 - Code: 0 - Url: [url]http://127.0.0.1:9898/app/scripts/app.js[/url]

The code is:

<td>
<iframe src="http://www.baidu.com/?q={{Record.keyword}}" width="100%" height="64px"></iframe>
</td>

Offline

#4 2016-10-11 15:24:17

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello Zeng,

I forget we deal with "src" attributes... in this case we can do something like this:

<td>
 <iframe ng-src="[trustSrc(Record.Url)]" width="100%" height="64px"></iframe>
</td>

However, note "Record.Url" must store the complete URL to be loaded into the "IFrame". So you must prepare a record's field with the URL you want to load into the "IFrame". Take a look at the "Report5" sample.

Offline

#5 2016-10-11 15:39:55

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello, David.

The above code works well.

I emphasis on "concatenate" to combine literal strings and Record attributes to get more flexibility just like Post #1.

Perhaps there is a way...

Thank you very much anyway. [:)]

Offline

#6 2016-10-11 15:42:51

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

David wrote:

Hello Zeng,

I forget we deal with "src" attributes... in this case we can do something like this:

<td>
 <iframe ng-src="[trustSrc(Record.Url)]" width="100%" height="64px"></iframe>
</td>

However, note "Record.Url" must store the complete URL to be loaded into the "IFrame". So you must prepare a record's field with the URL you want to load into the "IFrame". Take a look at the "Report5" sample.

I've read all the Report samples before I launch this post. :>

Offline

#7 2016-10-11 15:43:40

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello Zeng,

Yes; I understand. However, AngularJS doesn't allow concatenations in the context of an SRC attribute. If you receive the Records' data from the server, just concatenate the URL in a new record's field and use it in your application.

If the Records' data is local and you use an URL to load it (assigned to the Report control), you must modify the source file to add the appropiate URL record's field. If you use the Records' data variable instead of an URL, you must modify that variable accordingly to add the record's URL field.

Zeng wrote:

I've read all the Report samples before I launch this post. :>

That's good! But other people can also read this post. smile

Offline

#8 2016-10-11 15:47:09

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

David wrote:

Hello Zeng,

Yes; I understand. However, AngularJS doesn't allow concatenations in the context of an SRC attribute. If you receive the Records' data from the server, just concatenate the URL in a new record's field and use it in your application.

If the Records' data is local and you use an URL to load it (assigned to the Report control), you must modify the source file to add the appropiate URL record's field. If you use the Records' data variable instead of an URL, you must modify that variable accordingly to add the record's URL field.

Zeng wrote:

I've read all the Report samples before I launch this post. :>

That's good! But other people can also read this post. smile

Okey, I got it.

Thanks very much again!.  smile

Offline

#9 2016-10-11 15:48:26

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello Zeng,

Zeng Jinsong wrote:

Okey, I got it.

Thanks very much again!.  smile

No problem! Please, let me know if you have any further question or need some other help.

Offline

#10 2016-10-11 16:26:41

Zeng Jinsong
Member
Registered: 2016-01-19
Posts: 14

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Use a HTTPClient to get server data , then prepare URL with Records' attribute.

In HTTPClient's Success Event, type:

SetVar "[data]" "[HttpClient1.Response]" "String"

ArrayLength "[data]" "[count]"

Loop "0" "[count]-1" "[ii]"
     ArrayGetItem "[data]" "[ii]" "[row]"
     ObjectGetProp "[row]" "keyword" "[keyword]"
     ObjectSetProp "[row]" "url" "http://www.baidu.com/s?wd=[keyword]"  //Prepare url attribute
endloop

SetVar "[Report1.Data]" "[data]" "String"

In Report's HTML editor, type:

<td>
<iframe ng-src="[trustSrc(Record.url)]" height="280px"></iframe>
</td>

It works correctly.  cool

Last edited by Zeng Jinsong (2016-10-11 16:29:22)

Offline

#11 2016-10-11 16:29:11

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,660
Website

Re: How to concatenat URL with Record's attribute in Report's HTML editor?

Hello Zeng,

Yes; that's can be a possible approach. Thanks for sharing with us!

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.