Bug in Option List with Loaders

Asked

Viewed 14 times

0

I’m trying to make an option list in the loaders of a Struct. The code goes up, but when it comes to running, the Bug appears below: inserir a descrição da imagem aqui

I made an example template to try to isolate the error and identify the problem:

        +<a> : Struct {
            name = "Exemplo A"
            fields {
                +[booleanA] : Boolean {
                    name = "Sim ou Não"
                    request = "Sim ou Não"
                }
            }
        },
        +<b> : Struct {
            name = "Exemplo B"
            fields {
                +[listaA] : List ("Item A", "Item B", "Item C", "Item D") {
                    name = "Selecione o item da lista"
                    request = "Selecione o item da lista"
                    atomic = false
                }
            }
            loaders {
                if([a.booleanA] == true) {
                    [listaA].options = {"Item A", "Item B"}
                } else {
                    [listaA].options = {"Item C", "Item D"}
                }
            }
        }

1 answer

1

This bug happens because the loaders only processes objects within the struct in which it is inserted. In the example, it lies within the struct <b>, unable to operate with objects from struct <a>. To correct this, it is necessary to join the structs <a> and <b> example. I will demonstrate in the code below:

    +<a> : Struct {
        name = "Exemplo A"
        fields {
            +[booleanA] : Boolean {
                name = "Sim ou Não"
                request = "Sim ou Não"
            },
            +[listaA] : List ("Item A", "Item B", "Item C", "Item D") {
                name = "Selecione o item da lista"
                request = "Selecione o item da lista"
                atomic = false
            }
        }
        loaders {
            if([booleanA] == true) {
                [listaA].options = {"Item A", "Item B"}
            } else {
                [listaA].options = {"Item C", "Item D"}
            }
        }
    }

If you do not wish to join the structures, it will be necessary to perform the operation in a branch of logic, and not by loaders. Whereas the structures are those of the example without the loaders, the branch of lógica would conform to the code below:

    branch[BRC_Logica] {
        operations {
            if([a.booleanA] == true) {
                [b.listaA].options = {"Item A", "Item B"}
            } else {
                [b.listaA].options = {"Item C", "Item D"}
            }
        }
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.