2

I have a GeneXus KB that has webpanels and transactions that use the old editor for web forms. Is there a way to bulk convert to the new abstract editor? Can I make an extension to do it using the Genexus SDK ?

Can I make this change with an extension, using the GeneXus SDK?

Or can I do it with the IDE in bulk?

Convert to Abstract Editor

ealmeida
  • 444
  • 3
  • 11

1 Answers1

1

Currently, there is no option to convert in bulk.

You can make an extension that does it

  1. Within a web form there are multiple forms that can be the new Layout or the old Html layout, so first, you have to enumerate those

    using Artech.Genexus.Common.Parts;

    var webForm = webPanel.WebForm; foreach (MultiFormSerializer.Form form in MultiFormSerializer.GetForms(webForm.Document))

  2. To know which ones need conversion, you can check the handle

    using Artech.Genexus.Common.Parts.WebForm;

    if (form.Handler == MultiForm.Html)

  3. Then create the new form

    XmlElement elem = MultiForm.Layout.CreateForm(GetUniqueControlName)

    private string GetUniqueControlName(string baseControlName, bool startWithIndex) { return baseControlName; } // if you only have 1 form, you can just return that, else it must return a unique control name

  4. Make the conversion

    MultiForm.Layout.ConvertFrom(kbObj, elem, form.Handler, form.RootElement)

  5. Finally, assuming there is just one layout, save it

    var newForm = new MultiFormSerializer.Form(1, MultiForm.Layout, elem)

    webForm.Document = MultiFormSerializer.SaveForms(1, new List { newForm })

    webPanel.Save()

I haven't tested this code, but those are the steps that you have to do. If you have a problem, let me know.

GX Cristian
  • 146
  • 1
  • 4