Skip to content

Using cols() inside of a for loop  #40

@mthelm85

Description

@mthelm85

When attempting to access columns via cols() inside of a for loop, I get UndefVarError: i not defined.

function test(state::Int64, occ::Int64)
       @applychunked tbl begin
            @where !ismissing(:OCCP) &&
            :ST == state &&
            (:ESR == 1 || :ESR == 2) &&
            :OCCP == occ
            @groupby _ :PUMA { total = sum(:PWGTP), wgts = [sum(cols(Symbol("PWGTP$i"))) for i in 1:80] }
        end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions