Snowfakery icon indicating copy to clipboard operation
Snowfakery copied to clipboard

Allow for multiple combinations of selections (multi-select picklist)

Open Julian88Tex opened this issue 3 years ago • 5 comments

Description

Add in the ability to allow for multiple selections in order to work with multi-select picklists or similar database functionality. Currently, random_choice only allows for one individual selection at a time. Multi-select picklists can have multiple selections.

@prescod gave the example of DNA and proposed a new random_choices function:

DNA: 
  random_choices:
   min: 0
   max: 5_000_000
   with_replacement: True
   choices:
      - A
      - C
      - G
      - T

Above Potential Solution Description

  • min would be the minimum number of potential values returned which could be 0 (null). If no min is specified then 1 is assumed.
  • max would be the maximum number of potential values returned which could be any number. If no max is specified then the number of choices is assumed to be the max. The above example would default to 4.

In the above-proposed solution acceptable possible results would be:

  • "ACT"
  • "CGT"
  • "AT"
  • "AAAACCCGGTAACGT
  • ""
  • "G"

Additional info for Salesforce Internal Users is available here: https://salesforce-internal.slack.com/archives/C01KBFT16Q2/p1614027103002800

Julian88Tex avatar Mar 10 '21 06:03 Julian88Tex

@prescod Would you mind looking over this issue? Not sure if I captured everything you were thinking correctly. Also, couldn't remember what with_replacement meant.

Julian88Tex avatar Mar 10 '21 06:03 Julian88Tex

@Julian88Tex What is the best SFDO product to install to experiment with multi-select picklists? Or is there a standard object field I could use?

prescod avatar May 10 '21 21:05 prescod

@prescod I know of an SFDO-ish product from Salesforce Impact Labs project. I have this branch which I was working on a Snowfakery yml which includes this multiselect picklist fied.

Julian88Tex avatar May 10 '21 21:05 Julian88Tex

I ran into this when trying to populate EDA's hed__Race__c field, a multi-select picklist. As people can have more than one race, it would be great if Snowfakery could select more than one option. Right now, I'm just doing:

hed__Race__c:
  random_choice:
    choices:
        - American Indian/Alaskan Native
        - Asian
        - Black/African American
        - Native Hawaiian/Other Pacific Islander
        - White
        - NULL

Using the proposal above, something like this would work:

hms_Race__c:
  random_choice:
    min: 0
    max: 5
    with_replacement: True
    choices:
        - American Indian/Alaskan Native
        - Asian
        - Black/African American
        - Native Hawaiian/Other Pacific Islander
        - White

umeditor avatar Mar 22 '22 00:03 umeditor

I'd also love to use this for the Race MSP.

allisonletts avatar Dec 19 '22 18:12 allisonletts