Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
jrdunson
Contributor

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
MVP & Luminary
MVP & Luminary

Re: Clone Cyclic Group Variable?

HirisH_V7
Honored Contributor

Re: Clone Cyclic Group Variable?

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!”