none
Reference table name from the previous step RRS feed

  • Question

  • Hey, I'm trying to generate a bunch of Table.AddColumn code using a worksheet.

    My worksheet creates the following text:

    #"Added Charge Complete.data_matrix_id" = Table.AddColumn(#"Added timestamp", "SystemData.pvAvgVoltage", each if ([event_name] = "system" and [event_type] = 3) then [data.data.4] else null\),
    #"Added 0.energy Delivered" = Table.AddColumn(#"Added timestamp", "1.mpptAvgPower", each if ([event_name] = "system" and [event_type] = 3) then [data.data.5] else null\),
    #"Added data_matrix_id.elapsed time" = Table.AddColumn(#"Added timestamp", "pvAvgVoltage.mpptEnergy", each if ([event_name] = "system" and [event_type] = 3) then [data.data.6] else null\),

    The Table.AddColumn reference states that the signature is:

    Table.AddColumn(table as table, newColumnName as text, columnGenerator as function, optional columnType as nullable type) as table

    The problem I'm facing is that I'm hardcoding #"Added timestamp"as the table argument in the Table.AddColum function.  What I need is a way to dynamically reference the table name from the previous procedural step, such as:

    #"Added Charge Complete.data_matrix_id" = Table.AddColumn(*NAME_OF_TABLE_FROM_PREVIOUS_STEP*, "SystemData.pvAvgVoltage", each if ([event_name] = "system" and [event_type] = 3) then [data.data.4] else null\),
    #"Added 0.energy Delivered" = Table.AddColumn(*NAME_OF_TABLE_FROM_PREVIOUS_STEP*, "1.mpptAvgPower", each if ([event_name] = "system" and [event_type] = 3) then [data.data.5] else null\),
    #"Added data_matrix_id.elapsed time" = Table.AddColumn(*NAME_OF_TABLE_FROM_PREVIOUS_STEP*, "pvAvgVoltage.mpptEnergy", each if ([event_name] = "system" and [event_type] = 3) then [data.data.6] else null\),

    Is there any way to reference the table name from the previous step just before the current step?  This would replace the *NAME_OF_TABLE_FROM_PREVIOUS_STEP* text in the example above.

    Tuesday, December 3, 2019 3:49 PM

Answers

All replies