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

Clone Cyclic Group Variable?

Is there a way to clone a cyclic variable?

When we create a new one, it would be nice to clone an old one, and/or cut/paste an old one...

If not, can we add this feature in the next version?

PS... I'm using QV11

Jarrell

2 Replies
marcus_sommer

HirisH_V7
Master
Master

Hi ,

Like this using your macro ,

Sub RunCopyCycleGroup

'--------------------

CGName=inputbox("Enter name of cycle group to copy:Group1")

if trim(CGName)="" then 'no entry or cancel

  exit sub

  end if

NewName=inputbox("Enter name for copy of "&CGName&":Group2")

if trim(NewName)="" then 'no entry or cancel

  exit sub

  end if

Call CopyCycleGroup(CGName, NewName)

End Sub

'

Sub CopyCycleGroup(CGName, NewName)

'-----------------------------------

' /* Copy cycle group. OK if NewName exists. */

Set SrcGrp = ActiveDocument.GetGroup(CGName)

Set SrcProps = SrcGrp.GetProperties

Set NewGrp = ActiveDocument.GetGroup(NewName)

If NewGrp Is Nothing Then

  Set NewGrp = ActiveDocument.CreateGroup(NewName)

Else

  Set NewProps = NewGrp.GetProperties

  for i = 1 to NewProps.FieldDefs.Count

    NewGrp.RemoveField 0

    Next

  End If

Set NewProps = NewGrp.GetProperties

NewProps.FieldDefs.CopyFrom SrcProps.FieldDefs

NewProps.IsCyclic = SrcProps.IsCyclic

NewProps.Labels = SrcProps.Labels

NewProps.Present = SrcProps.Present

NewProps.SortCriterias.CopyFrom SrcProps.SortCriterias

NewGrp.SetProperties NewProps

msgbox CGName&" copied to "&NewName

End Sub

In the QVW attached group 1 is copied as group 2.

PFA,

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”