Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data query does not show 0 in human result format #1892

Closed
leostewart opened this issue Jan 22, 2023 · 3 comments · Fixed by salesforcecli/plugin-data#470
Closed

data query does not show 0 in human result format #1892

leostewart opened this issue Jan 22, 2023 · 3 comments · Fixed by salesforcecli/plugin-data#470
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@leostewart
Copy link

leostewart commented Jan 22, 2023

Summary

The number zero is suppressed or returns null when executing a SOQL query in human result format. Both json and csv formats work as expected.

Steps To Reproduce:

  1. Create a record with field value 0, e.g.
sfdx data record create -s Opportunity -v "Name=testOpportunity StageName=Prospecting CloseDate=2023-12-31 Amount=0"
  1. Query the record's field
sfdx data query -q "SELECT Name, Amount FROM Opportunity WHERE Name='testOpportunity'"

Expected result

Output the record with the field value as 0

 NAME            AMOUNT 
 ─────────────── ────── 
 testOpportunity 0      
Total number of records retrieved: 1.
Querying Data... done

Actual result

The field value is suppressed

 NAME            AMOUNT 
 ─────────────── ────── 
 testOpportunity        
Total number of records retrieved: 1.
Querying Data... done

System Information

{
  "cliVersion": "sfdx-cli/7.185.0",
  "architecture": "linux-arm64",
  "nodeVersion": "node-v18.13.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.10 (core)",
    "@oclif/plugin-commands 2.2.2 (core)",
    "@oclif/plugin-help 5.1.22 (core)",
    "@oclif/plugin-not-found 2.3.13 (core)",
    "@oclif/plugin-plugins 2.1.8 (core)",
    "@oclif/plugin-search 0.0.8 (core)",
    "@oclif/plugin-update 3.0.9 (core)",
    "@oclif/plugin-version 1.1.4 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.19 (core)",
    "@oclif/plugin-which 2.2.6 (core)",
    "alias 2.1.18 (core)",
    "apex 1.4.2 (core)",
    "auth 2.3.12 (core)",
    "community 2.1.3 (core)",
    "config 1.4.23 (core)",
    "custom-metadata 2.0.11 (core)",
    "data 2.1.22 (core)",
    "generator 2.0.16 (core)",
    "info 2.3.3 (core)",
    "limits 2.2.3 (core)",
    "org 2.2.22 (core)",
    "packaging 1.12.3 (core)",
    "schema 2.2.2 (core)",
    "signups 1.2.12 (core)",
    "source 2.3.15 (core)",
    "telemetry 2.0.5 (core)",
    "templates 55.2.1 (core)",
    "trust 2.2.8 (core)",
    "user 2.1.25 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "salesforce-alm 54.8.5 (core)"
  ],
  "osVersion": "Linux 5.10.124-linuxkit",
  "shell": "bash",
  "rootPath": "/usr/local/share/npm-global/lib/node_modules/sfdx-cli"
}

Additional information

This also affects aggregate queries and subqueries.

Aggregate query

Expected result
 COUNT(ID) 
 ───────── 
 0         
Total number of records retrieved: 1.
Querying Data... done
Actual result
 COUNT(ID) 
 ───────── 
           
Total number of records retrieved: 1.
Querying Data... done

Subquery

Expected result
 OPPORTUNITIES.AMOUNT 
 ──────────────────── 
 0                    
Total number of records retrieved: 1.
Querying Data... done
Actual result
 OPPORTUNITIES.AMOUNT 
 ──────────────────── 
 null                 
Total number of records retrieved: 1.
Querying Data... done
@leostewart leostewart added the investigating We're actively investigating this issue label Jan 22, 2023
@github-actions
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@WillieRuemmele
Copy link
Member

Hi @leostewart - thanks for the great reproduction 🎉

@WillieRuemmele WillieRuemmele added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Jan 23, 2023
@git2gus
Copy link

git2gus bot commented Jan 23, 2023

This issue has been linked to a new work item: W-12421703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants