top of page

Connected Records Workaround with a Knack Database



This week I had an issue getting some records associated with a logged-in user to display how I wanted in my Knack database app. It had to so with some limits that exist when viewing a record detail and also trying to automatically filter by things related to the logged-in user. Well, with a little help from Knack's support, I now have a good workaround that does the job. Check it out.


Interested in my Knack database services? ... Book a call with me here: https://calendly.com/daveparrish/callwithdave


If you are a fan of building great apps with Knack, please click the Subscribe button to join my channel, and ring the bell to receive notices on all my new instructional videos. Thanks!









Full Transcript

folks Dave Parish here again

doing videos on neck functionality I

appreciate you tuning in here here's

what I got today jump right into it I'm

kind of logged in

user connection work around now I was

building this app this just came up this

week by the way

we're on a detailed view of something

in the study I wanted to create a table

underneath it related to the detail uh

so connected records to my detail page

object and then I further wanted that

I only want to display records those

connected records that were connected to

the logged in user users have a site

they're associated with so when they

went to the detail page those related

records I only wanted the show not only

related records to my detailed object

but only show the records that were

associated with the site of the logged

in user Knack would not do that

at least the way I was expecting and I

actually got this from their tech

support I found a workaround and works pretty

well so I'm going to go through that

thanks

okay let's just get going on this right

now I'm going to call up the app first I'm

going to show you what this app does I'm

at the right place here yeah

it's an app that tracks

sort of a chain of custody out custody

I'll call it of medical devices that are

being tested I think it's simulated some

FDA type of deal this doesn't include

clinical data but it just shows anyone

who's touched this device so there's a

clear record of where and who and what

uh when type stuff of this device so

let's just do this as for an example we

create a study I'm going to be quick on

it here's a study in this study it

doesn't matter top stuff it has several

different devices that are going to be

part of this study and each of these

device can end up at a different

site there could be a doctor's office a

hospital clinic whatever so it ends up

here now at the same time there's users

in my mouse to work here uh go to data

coordinators are the users at the

different sites so when they go to a and

they're assigned to a study too so let's

see what they have here

let's go to the coordinator page hey I'm

a coordinator

and I sign in I've been assigned to

different studies I'm only going to see

the studies that are assigned to me

that's cool no problem with that

whatsoever now I go to a study

let's go to this one what I want is to

be able to I go to a study that I'm

assigned to these items underneath I

only want for that study to show the

studies

the items the devices from that study

to which I am assigned as the same site

so this study may have four different

items going out to different sites I

only want when I'm a coordinator

to only see this devices that are

decided which I reside I couldn't get it

to do that uh and I'm going to show you

what it did here's what I was expecting

if I go to coordinator page

here's the studies this one's easy uh

this study this shows studies connected

logged in a user that logged in thing

you see it all the time when you do it

do you want to add something do you want

to be related to the login user go to

the detail page so now I'm at a detail

page of the study itself if I go here I

want a grid an inventories is what I'm

looking for these are the device

inventories click it

now what I was expecting to see stuff

related login user and we sort of double

dealings here we have related to the

study we got another thing coming from

side which is the site of the login user

um but it wouldn't do that I

contradict contacted their support and

they did they gave me a workaround I

don't think it might be new but

it's not perfect but it's pretty good

instead of using I'm gonna do this a

grid view what they're calling now you

can use a search view if search it was

basically a grid view but it has

search criteria up top uh which can

result in a table can result in a list

too but a table usually here's this

table I want so what we can do they have

a special functionality which may be new

by the way watch this here's my criteria

the only criteria I'm going to make

is uh my site if you click on this and

go down to further details

show you're used to the show stuff on a

lot of things so instead of showing all

Sites it says okay when the user is

selecting criteria or has the criteria

and they want to select it we're going

to limit to what they can use or what

they can select from and in this case

we're going to limit it to only

sites that they're they're associated

with which gets me to where I want to be

and then I did some further stuff

I'm gonna go back here on the data side

inventory site

I made it radio buttons

and I made it value be the first one

or its default value

so I'm gonna put this in practice well

I'm going to go back here real quick

this and this

this gets the job done use a search now

if you had a whole bunch of different

criteria or there was lots of sites you

were associated with or a whole number

other finials this may not work or may

not be as smooth as this particular

thing but let's go give an example here

here I am

I picked the study I want to be to I'm a

logged in coordinator

here's my met test site

remember this used to have four and here

are my inventories in the state your site we

can put some words here that make it a

little more user friendly but um now

it's just giving me the two instead of

those four there's two that only two of

these items are associated with my site

and the other two aren't so they're not

showing up and by the way since this is

pre-selected I did this and I'm going to

thank Ian at Mac Pros

for giving me a small piece of code

that won this when this page loads

it automatically clicks search so

instead of let's do this instead of the

coordinator clicking study having to

populate with a blank thing uh we got to

reset this hey man

period instead of them having to do what

I just did click this I might have to

work on some timing issues there that it

automatically does it so it's sort of

seamless and in fact it'd be even better

there might be some code it's a real

small piece of code that allows me to

even hide this so this search criteria thing just sort

of goes away and it just automatically

populates with it but regardless that

works and then these further details

stuffer I won't get into it just goes

along to the normal thing we do

hope that was a little helpful for

something it was for me appreciate it

thanks.







9 views0 comments
bottom of page