cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Node constraints defined in segment

nborrerojr.
12-Amethyst

Node constraints defined in segment

Is there a way to constrain the options for Category that are available to a node by constraining it from the segment that uses it?

ACCEPTED SOLUTION

Accepted Solutions

Hi Nolin,

this should be possible.

You need to "map" the selected Category from the segment into the node Items.

As there is no direct relationship to the segment for all levels of content, you cannot use a FVA; but a a computed field migth help.

Something like :

isEmpty(getFieldValue(DocumentID(), Category),Text("-unknown-"))

should give you a Shorttext representation of the segment's Category value.

Than you should be able to build a contraint based on that text field in the content type as intended.

HTH Matthias

View solution in original post

12 REPLIES 12

Hi Nolin,

this should be possible.

You need to "map" the selected Category from the segment into the node Items.

As there is no direct relationship to the segment for all levels of content, you cannot use a FVA; but a a computed field migth help.

Something like :

isEmpty(getFieldValue(DocumentID(), Category),Text("-unknown-"))

should give you a Shorttext representation of the segment's Category value.

Than you should be able to build a contraint based on that text field in the content type as intended.

HTH Matthias

nborrerojr.
12-Amethyst
(To:mrump)

Is there a way to get a property instead of a field? Something like getPropertyValue()?

If you can use a constraint of type "Rule", then you may be able to use the condition "Check a property associated with the item's type".

If I create the rule, then I reference the property and constrain the options available to the segment but I can't constrain the options on the node. I tried creating a new field for the segment and constraining that but the problem I ran into was that it then required the user to manually set the value for that field.

Ah, I realized I can restrict and change the default with Overrides for Fields and then the user never has to select the value. This might be the solution.

nborrerojr.
12-Amethyst
(To:mrump)

When I try this i get "MKS124553: IsEmpty: Both arguments must be of the same data type." Is this because Category is a pick list and Text("-unknown-") is text?

nborrerojr.
12-Amethyst
(To:mrump)

getFieldValue for picklists returns an integer. Is there a way to use this integer to get the corresponding string that this represents? For example, instead of getting the number "3" back for Category (or whatever the actual number is), I want to see "Document".

I haven't tried it, but the documentation for the getFieldDisplayString() method sounds like it could do what you want.

Edit: This was taken from the trigger method documentation. I do not know if it is possible to use this in a field computation.

I get "Unknown function name". Does that exist in Integrity 10.5?

An error occurred parsing the computation expression "getFieldDisplayString(DocumentID(),Type)": MKS124538: getFieldDisplayString: Unknown function name

The function exists, but I suspect it is only for use with trigger beans (imIssueBean) rather than field computations. I initially thought you were talking about trigger methods since there is a getFieldValue() method in the beans as well. My apologies!

nborrerojr.
12-Amethyst
(To:mrump)

What I ended up doing is using getFieldValue(DocumentID(),Type) and just using the integer that is returned to create a constraint. The only real downsides are that I have to check what integer should be returned for each applicable segment type. Also, when someone looks at the constraint later on it may not be quite as straight forward. This seems to be working though.

Apparently this only works for existing nodes. When I try to create a new node, I get an error that says:

Unable to evaluate source relationship based on field Segment Type because its computation involves an external information function

The full computation is: getFieldValue(DocumentID(),Type)

Any ideas how to make this work?

Announcements


Top Tags