Simple Questions from a n00b

I'm having an issue with two of my interfaces.
 
1. For the interface that manages the employees in an editable grid, I want to have a dropdown box that selects who that person reports to. In the CDT for employees, I have a field called "isSupervisor" that is boolean. I want only the people that have that field set to "true" to show up in the dropdown. I tried using: 
 
choiceValues/Labels: index(local!newEmployee.firstName, where(local!newEmployee.isSupervisor))
 
and various other configurations for a default value. I'm not sure if those are the right functions to use, and whenever I don't get parameter errors, local!newEmployee.isSupervisor seems to be passing a null value, which value parameters don't like. As far as I know, that variable should not be passing a null value, because, without that dropdown box, the interface works and I was able to add data to the data store. I don't understand 100% how index() works and I'm assuming, from the documentation, that where() should parse the array and only return the variables that are true, by default.
 
2. In the interface for adding vehicles to the inventory, all of the variables update when I input data. Except for the username and vehicle field. They are setup thusly:
 
username:
 
a!textField(
      label: "Associate making the change:",
      refreshAfter: "KEYPRESS",
      value: rule!FSRC_Common_GetFullNameForUser(loggedInUser()),
      saveInto: ri!vehicles.addedBy
      readOnly: true
 
vehicle:
 
a!textField(
      label: "Vehicle being added:",
      value: upper(
        concat({local!year}," ",{local!make}," ",{local!model})
        ),
        saveInto: ri!vehicles.vehicle,
      readOnly: true
 
These components produce the proper values, but they do not update the declared rule inputs. So, if I use a!writeToDataStoreEntity(), it doesn't work, because those values are still null. I thought about using local variables and wrapping those text boxes in a with(), but I don't know if that would work or not. I haven't tried it.
 
Any help would be appreciated.
 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    1. If your value is null in a dropdown component, the component will throw an error unless you specify the placeholderLabel attribute. This might help in your debugging. It would be helpful if you posted a more verbose snippet so we could see what exactly the problem is.

    2. saveInto is only triggered when the user interacts with the field. Because your fields are read only, the saveInto will never be triggered, which is why you see the proper value, but you do not see the value saved to the rule input field. One common way around this is to either load the values in the input of your user input task, or save them on button press (ex. a!buttonWidgetSubmit(saveInto: {a!save(ri!vehicles.vehicle, concat({local!year}," ",{local!make}," ",{local!model}))}))
  • Thank you for your reply, Josh. I do configure a placeholderLabel for the dropdown box and there is data in the entity.

    1. Here is the complete code for the dropdown field:

    a!dropdownField(
                    label: "Supervisor",
                    labelPosition: "ADJACENT",
                    placeHolderLabel: "--- Select One ---",
                    choiceLabels: index(local!newEmployee.firstName, where(local!newEmployee.isSupervisor)),
                    choiceValues: index(local!newEmployee.firstName, where(local!newEmployee.isSupervisor)),
                    saveInto: {
                      local!newEmployee.supervisor
                    },
                    refreshAfter: "UNFOCUS",
                    validations: {}
                    )
                    
                    

    I believe this configuration gives and error saying that the value is null. I can't verify at the moment because I have an unrelated DB issue I have to fix later today.

    This interface is also configured with a!writeToDataStoreEntity(), so when I don't get an error, for example, if I just configure this field as a textField, then it saves and updates the data store successfully.

     

    2. I will try those suggestions when I can. Thank you.

Reply
  • Thank you for your reply, Josh. I do configure a placeholderLabel for the dropdown box and there is data in the entity.

    1. Here is the complete code for the dropdown field:

    a!dropdownField(
                    label: "Supervisor",
                    labelPosition: "ADJACENT",
                    placeHolderLabel: "--- Select One ---",
                    choiceLabels: index(local!newEmployee.firstName, where(local!newEmployee.isSupervisor)),
                    choiceValues: index(local!newEmployee.firstName, where(local!newEmployee.isSupervisor)),
                    saveInto: {
                      local!newEmployee.supervisor
                    },
                    refreshAfter: "UNFOCUS",
                    validations: {}
                    )
                    
                    

    I believe this configuration gives and error saying that the value is null. I can't verify at the moment because I have an unrelated DB issue I have to fix later today.

    This interface is also configured with a!writeToDataStoreEntity(), so when I don't get an error, for example, if I just configure this field as a textField, then it saves and updates the data store successfully.

     

    2. I will try those suggestions when I can. Thank you.

Children