dbt_netsuite icon indicating copy to clipboard operation
dbt_netsuite copied to clipboard

[FEATURE] stg_netsuite2_transactions.status does not provide "display" status

Open ghost opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the issue

The current package setup returns 'A', 'B', 'C', etc as transactions status (differently from NS1). NS2 provides a dedicated function to calculate the display status: https://timdietrich.me/blog/netsuite-suiteql-transaction-statuses/

Relevant error log or model output

No response

Expected behavior

The "display" status should be 'Fully Billed', 'Open', etc

dbt Project configurations

basic config

Package versions

0.7.1

What database are you using dbt with?

snowflake

dbt Version

1.3.2

Additional Context

Solution 1: package should foresee the join with stg_netsuite2__transactionstatus on status and type

FROM {{ ref('stg_netsuite2__transactions') }} AS transactions
INNER JOIN {{ ref('stg_transaction_status') }} AS status_map
    ON transactions.status = status_map.id
        AND transactions.transaction_type = status_map.trantype

Solution 2: adding the conversion in the _tmp model

Solution 3: a macro to get the value from the transaction status and type:

{% macro get_status_display_value(tr_status, tr_type) %}
    SELECT name
    FROM {{ source('netsuite2', 'transactionstatus') }}
    WHERE id = {{ tr_status }}
    AND trantype = {{ tr_type }}
{% endmacro %}

Are you willing to open a PR to help address this issue?

  • [X] Yes.
  • [ ] Yes, but I will need assistance and will schedule time during our office hours for guidance
  • [ ] No.

ghost avatar Mar 13 '23 10:03 ghost