In order to run power bi embedded inside my knack app, I need to use a dynamic token from time to time.
I already created the flow to always get the updated token value and it's being recorded to field_1934 inside my knack app.
This field_1934 is inside an object with only two fields. The increment field and a paragraph field and there is only one line on it. The increment 1 and the token info which is updated every 5 minutes.
So I need to insert in my javascript code the reference for this specific paragraph field where the token is updated.
Can anyone tell me the reference for the value inside this specific field_1934 value so I can add it to my javascript code?
Hi Brad, No luck yet, but thanks for all your effort. I feel uncomfortable using so much of your time, so feel free to draw a line in the sand on this :)
If that doesn't work then try again with exactly the same code you listed above for entire richtext view, including the hardcoded file and see if that works...
Hi Brad, didn't quite work, but I think we're getting close. I changed the iframe reference in the rich text box to src=, and I get this error:
{"error":"Application not found","application":"pdflink"}
By the way, one reason that I didn't put the script in the rich text box is that I think Knack are disabling scripts other than ones that are 'whitewashed' from running in side the pages - but anything goes in the javascripting section.,
There's a few ways to do this include inserting the iframe purely in code, but then it gives you less control over where it's placed. So keeping your current views here's one way i think will work.
At the top of these images I have the javascript. Below that, you can see a page, coming off a table (so there is a record linked to it), with 2 elements - the first, scene 1257 is a details thingy, and the 3rd field in that is hyperlink to a pdf shared in Google drive. The javascript is supposed to load that into the variable called pdflink, so that in the second element, a rich text box, I can open that very same file with an iframe. Note that there are 2 iframe references in the rich text box, the 2nd one is just a test, and has a hard-coded file reference, and works perfectly.
I am sure I am doing something blatantly stupid - I'm just bluffing my way through ths :)
Thanks for that advice. I think the field is all present and correct, but for some reason the variable is not being populated. I wish I knew some local javascriptors :) Thanks
Yes I admit I haven't participated in the Slack group much...
The url for the pdf should be contained in the data returned from the view-render - you might need to inspect the data closely to get it right though.
$(document).on('knack-view-render.view_1252', function (event, view, data) { console.log(data); //Pay close attention to field_668 var pdflink = data.field_668_raw[0]; });
If you're trying to get pdflink when the 'view opens' try inside a view-render event.
And remove the extra (. If thise doesn't work try console.log(data); to see what's there and you might need to add that field to the view if field_668 isn't listed.
$(document).on('knack-view-render.view_1252', function (event, view, data) {
Hi guys, I have a really similar question. I want to grab a field variable (actually it is url link to a shared file on google drive) so that I can use that link in an iframe. The link is not shown in the view - it is in field 668 of the object. I have used this instruction, but it is not working. I have no knowledge of javascript, I am just making it up based on examples I can find :). one problem might be that I am trying to make this happen with the view open, but the form is not submitted?
$(document).on('knack-record-update.view_1252', function (event, view, record) {
Its just to show you where the value of the token and url should be added. Can you please remove the [[ ]] and add the correct code to use the fields value that we searched before it? Tks!
Ok, if field_1936 is a text field with an url value simply add:
var myToken = data.records[0].field_1934); // HERE YOU GET THE TOKEN VALUE
var myURL = data.records[0].field_1936); // This line get the url value
And then in your embed configuration,
var embedConfiguration = {type: 'report',accessToken: '[[[myToken]]]',id: '3c0ae9a0-550f-4920-b4c0-a26a29b76ee9',embedUrl: '[[[myURL]]]'};
I'm not sure why the [[[...]]] are used in the field reference. I don't know if it will give you problems or you should just use the variable names without triple [[[
Let me know if it works for you, if not, I would have to do tests with the code in your live app...
In your knack object, field_1936 is an url field? I can see in yor screenshot only two fields, autoincrement and a paragraph field with the token value?