# Display Rules Using Values from Connected Object's Field

**URL:** <https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543>\
**Category:** Get Answers\
**Created:** [June 30, 2023, 1:33pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543 "2023-06-30T13:33:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 11:18am UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/21 "2023-07-20T11:18:34Z")

</div>

Good Morning…

I’m heading out in a few minutes. My version of KTL is 0.13.15.

Suggestions on getting 0.14.0

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 11:26am UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/22 "2023-07-20T11:26:05Z")

</div>

Oh! That explains everything.  
It’s good news then.

Here’s how you force the KTL to use a specific version:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/1/1c87c67580c0a3f342bf08c89f8ba3434d4b80e1.png)

If you don’t specify the version info (two empty quotes ‘’), it will use the latest official release, which is 0.13.15 in this case. If you write a version, it will switch to it.

The “Full” option simply means that it will use non-minified code. You save on memory usage, and download time, but it’s quite negligible and makes the code much easier to read. Useful when debugging. Not required but will be useful eventually - I’m pretty sure.

ND

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 11:40am UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/23 "2023-07-20T11:40:20Z")

</div>

You are the man, works as expected.

**This is a great feature for me and hopefully others.**

Is it “currently” possible to show a field’s value using the \_cfv keyword?

Example: if field\_380 is “YES” then show field\_100’s value?

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 12:18pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/24 "2023-07-20T12:18:08Z")

</div>

Glad to read that Jon!

I am now working on supporting multiple ktlTarget fields in other view types. So in a couple of days, you will be able to return to the default “” version (blank = latest). I will let you know.

> [@Jon1](#):
>
> Is it “currently” possible to show a field’s value using the \_cfv keyword?
> 
> Example: if field\_380 is “YES” then show field\_100’s value?

If the hidden state is done in the Builder with a Display rule, then the answer is no. Simply because there’s no way for the KTL to tell Knack to show something.

To do what you want to do, the Builder must always show the field and value, then the KTL can play with its own display rules. Now at the moment, there’s no provision to show something. Only to hide.

To better understand your use case, are you saying that you’d like to use…

**\_hf=field\_100** (to hide by default)

then use something like  
**\_cfv=[field\_380, eq, YES, , , , s], [ktlTarget, field\_100]**

To “unhide” (s for show) field\_380 ?

BTW, when I refer to _hiding a field_, I imply both the field and its value.

Norm

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 12:45pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/25 "2023-07-20T12:45:03Z")

</div>

I’d like to have the ability to “hide” a field and it’s value based on the value of a connected field, like you’ve successfully done with the keyword \_cfv (e.g. field\_380 is “NO” then hide field\_100 name and value).

But at the same time, I’d like to be able to “show” a field and it’s value (possibly with different keyword) based on connected field’s value.

Example, if field\_380 is “YES” the **show** field 101’s value.

Same with the action links, if field\_380 is “NO” hide action link “testlink1” but if field 380 is “YES” show action link “testlink2”.

Basically I’d like to have the ability to “hide” or “show” fields like the display rules for a details page does but have the ability to reference a connected field like you were able to do with “\_cfv”

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 1:31pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/26 "2023-07-20T13:31:36Z")

</div>

Hey Norm, the more I mess with this new feature the more I like it and the closer it will resolve me having to rely on Knack’s task systems which is super unreliable and slow.

Couple questions, is there a way of have multiple \_cfv strings?

When I apply the following, only the 2nd \_cfv rule is working.

\_cfv=[field\_380, eq, NO, , , ,hp], [ktlTarget, Status]  
\_cfv=[field\_389, eq, OutofOffice, , , s], [ktlTarget, Work Mode Message]

Currently if I hide a field’s label using the label properties in Knack and try to us your new feature, doesn’t work unless I show the label. Is there a way to hide the label and show the field value with your new \_cfv feature? Field 389 above is a field that contains a message. I’d like to be able to show the message only and not the label and the message.

Thanks again Norm…

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 2:24pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/27 "2023-07-20T14:24:55Z")

</div>

> [@Jon1](#):
>
> But at the same time, I’d like to be able to “show” a field and it’s value (possibly with different keyword) based on connected field’s value.
> 
> Example, if field\_380 is “YES” the **show** field 101’s value.

You want to show something, but you don’t say **how it was hidden** in the first place. You only have two ways to hide a field/value:

1. In the Builder, using a Display Rule. In this case, you **can’t “unhide”** that field because the control occurs on the server side. We can only control what’s happening on the client side. If the server doesn’t send you the field/value… how can you show it?! The same as if I’d send you an empty envelope by mail and ask you to read the letter inside.

2. At runtime, via the KTL or some code+CSS trick like _display:none_, change transparency to 100%, or move away off screen. In this case, it’s possible to show something that’s been hidden. Either simply re-render the view of remove the style or position that makes it invisible.

ND

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 2:27pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/28 "2023-07-20T14:27:55Z")

</div>

> [@Jon1](#):
>
> is there a way of have multiple \_cfv strings?
> 
> When I apply the following, only the 2nd \_cfv rule is working.

Currently no, only the last one will be applied. This is mentioned in the documentation BTW.

See here: [Keywords · cortexrd/Knack-Toolkit-Library Wiki (github.com)](https://github.com/cortexrd/Knack-Toolkit-Library/wiki/Keywords#keywords-list)

_“Note: for any keyword used in a field or view, **only one instance of each kind** can be used. If more than one are included, only the last one will take effect.”_

Heard of RTFM? _Read The Fantastic Manual_ !!! 🤣

But that’s on the works for sure. I knew someone would request this before long!

Norm

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 2:53pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/29 "2023-07-20T14:53:54Z")

</div>

Your new feature is giving me the ability to show a field’s value exactly how I want it to with the exception I’d like to be able to keep the field label “hidden” using either with customization from you or using Knack’s display field properties. Having the ability to have multiple \_cfv strings would be nice. \_csv1, \_csv2 ???

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 4:30pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/30 "2023-07-20T16:30:19Z")

</div>

Very happy you like it.

About hiding the label of a field, there’s an undocumented keyword that I’ve coded recently that does that.

Try adding this in your details view:

**\_cls=[ktlHidden], [ktlTarget, .field\_1 .kn-detail-label]**

Replace field\_1 with your field ID.

It adds a class **ktlHidden** to the jQuery selector “ **.field\_1 .kn-detail-label** ” which points to the label of that field.

Enjoy,  
Norm

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 7:39pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/31 "2023-07-20T19:39:35Z")

</div>

> [@Jon1](#):
>
> Having the ability to have multiple \_cfv strings would be nice. \_csv1, \_csv2 ???

I am almost finished coding this capability. It will be ready by tomorrow in several keywords, including \_cfv, and \_cls.

That will be **amazingly powerful**!!! 🤩 😁 🕶  
Stay tuned.

Norm

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 20, 2023, 7:58pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/32 "2023-07-20T19:58:57Z")

</div>

Thank again Norm… JON

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 20, 2023, 10:44pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/33 "2023-07-20T22:44:18Z")

</div>

Jon,

You can give it a try now, with \_cfv=… \_cfv2=… \_cfv3=… etc.

Do **Ctrl+F5** to refresh the cache.

Norm

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 21, 2023, 12:51pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/34 "2023-07-21T12:51:24Z")

</div>

Good Morning Norm, everything you’ve done so far, is working GREAT!!!

Only one thing I’m trying to figure out:

Currently in the page display rules in Knack I have the following “two part” rule:

If field\_30 is “N/A” **and** field\_47 is “NO” then show field\_100.

Is this currently possible to do with what you done? If so, how?

I know some will ask why not just keep the display rule, but the whole reason for me needing this KTL feature is to get away from using Knack’s **very unreliable and slow** task management system. Sometimes the tasks are done within 10 minutes, the very next day it takes 2+ hours for the same exact task it did the previous day. With Norm’s KTL system and all that he’s done, I’m that much closer to not using Knack’s task system.

I truly appreciate your time and effort on helping me Norm… JON

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 21, 2023, 4:32pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/35 "2023-07-21T16:32:28Z")

</div>

Thanks Jon for the nice comments, it’s highly appreciated.

At the moment, the operator in the \_cfv keyword is unique, so only one condition is supported. I will eventually try to figure out a way to handle multiple conditional statements, but that will be very complex. It’s not on my short term todo list.

About multiple keywords of same kind in a view/field, I will change that a bit to avoid the numbered keywords. You will only have to use the same plain keyword like this, for example:

\_cfv=[group1, …], [group2, …], [ktlRoles, Manager]  
\_cfv=[group1, …], [group2, …], [ktlRoles, Supervisor]  
\_cfv=[group1, …], [group2, …], [ktlRoles, President]

No more \_cfv2, \_cfv3, etc.

So be prepared to change all those you’re currently have using number suffixes, as both formats will not be supported.

Will let you know when the change if done.

BTW…  
To keep track of all the keywords you have, go in the console and type **ktlkw()**. This lists all keywords and their parameters.

You can also use **ktlkw(‘\_cfv’)** to see only this keyword.

Norm

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [July 22, 2023, 7:46pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/36 "2023-07-22T19:46:39Z")

</div>

Hi Jon,

I’ve completed the big changes:

1. All keywords now support ktlRoles
2. These keywords can now be used multiple times in a view of field:

- \_cfv
- \_cls
- \_hf
- \_hc
- \_rc
- \_style

Again as a reminder, you don’t use the numbers as per initial design, like \_cfv **2**. Just multiple \_cfv will work.

These additions now allow you to do all kind of crazy combinations and also apply the keywords on a per-role basis.

Note that the changes in the code were **massive**. I’d ask you to keep an eye on your console output as much as possible for the next few days, and let me know if you see any errors.

We’re still at **0.14.0** , so do a Ctrl+F5 to see the changes.

Chees,  
Normand

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [July 25, 2023, 2:35pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/37 "2023-07-25T14:35:36Z")

</div>

Thanks Norm, will give changes a try… JON

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [October 2, 2023, 2:21pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/38 "2023-10-02T14:21:20Z")

</div>

Hey Norm, I’m trying to hide an action link based on another field’s value in a table view. Can’t seem to get it to work using above suggestions.

Here is what I need: Hide action link “test1” if field value of “field\_346” equals “YES”.

Here is what I tried: \_cfv =[field\_346,is,YES,h], [ktlTarget, #view\_233.kn-table-link:contains(“test1”)

When I try the above it hides all of data in the entire table. I’m looking for it to hide just the action link (test1) for that particular record if field\_346 = “YES”

Any and all help would be appreciated… JON

---

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [October 3, 2023, 11:53am UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/39 "2023-10-03T11:53:12Z")

</div>

Hi Jon,

I see two problems with your string:

`_cfv =[field_346,is,YES,h], [ktlTarget, #view_233.kn-table-link:contains(“test1”)`

1. The option is not closed properly. The last square bracket is missing.
2. The jQuery selector must be in it’s special syntax $(‘_selector_’)

Try this:

`_cfv =[field_346,is,YES,h], [ktlTarget, $('#view_233.kn-table-link:contains(“test1”)')]`

Norm

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [October 3, 2023, 3:03pm UTC](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543/40 "2023-10-03T15:03:23Z")

</div>

Thank you as always Norm.

Will give it a try… JON

[Previous page](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543.md?page=1)

[Next page](https://forums.knack.com/t/display-rules-using-values-from-connected-objects-field/14543.md?page=3)
