Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
johngouws
Partner - Specialist
Partner - Specialist

OneAndOnlyOne as a Action

Hi,

I am able to run a macro to select and set a object to alwaysoneselected. See below. This normally happens on Open Document. 

     ActiveDocument.Fields("Report_Date").Select "=max(Report_Date)"

     set fld=ActiveDocument.GetField("Report_Date")

     set fprop = fld.GetProperties

     fprop.OneAndOnlyOne = true

     fld.SetProperties fprop

I need / want to get away from this practice and rather use a trigger. So how I see this working is to have a landing page with some values and buttons. The buttons are to direct the user to specific subject. On selecting the relevant button, the action can direct a user to the subject and set the alwaysoneselected field for that subject. The part of directing the user to the tab is the simple part. I would appreciate assistance on 'OneAndOnlyOne = true' as a trigger.

I have looked at the API, but must be honest, it looks like it was written in a foreign code! I would appreciate any pointers on this.

Thanks - John.

1 Solution

Accepted Solutions
marcus_sommer

Yes, the search-string needs to be independent from the current selection. This could be achieved with set analysis:

max({1} Report_Date) // maybe with further conditions

- Marcus

View solution in original post

6 Replies
marcus_sommer

With actions it's not possible to read/set/change object-properties. But I don't understand what do you want to achieve - you could set the OneAndOnlyOne option before and used by opening directly a select-action with a search-string with max(Report_Date).

- Marcus

johngouws
Partner - Specialist
Partner - Specialist
Author

Hi Marcus, Thanks for the reply.

I have a List Box which holds the Report_Date. I can use the =max(Report_Date) in the action to select it. I want to also set the List Box to OneAndOnlyOne selected. Because of what I am trying to show the user I don't want the user to be able to 'unselect' the Report_Date by selecting 'clear'. The user must also not be able to select more than 1 of the Report_Dates.

If a action cannot read/set/change object-properties, then I need to find another solution.

-John

marcus_sommer

It's clear why do you want to have this field with OneAndOnlyOne but not why do you not enabled these option before and saved the app with this.

- Marcus

johngouws
Partner - Specialist
Partner - Specialist
Author

Hi Marcus,

That does not work.

If I select yesterday's date in the list box and set the list box as Always One Selected Value, then save the model.

I then have a trigger on Opening to set the Report_Date to =max(Report_Date). The Report_Date remains yesterday's date. Even if I have a action on a button as =max(Report_Date), it remains yesterdays date.


John-

marcus_sommer

Yes, the search-string needs to be independent from the current selection. This could be achieved with set analysis:

max({1} Report_Date) // maybe with further conditions

- Marcus

johngouws
Partner - Specialist
Partner - Specialist
Author

Oh nooo!!.

Thanks Marcus I appreciate it.