on 2024 Sep 30 9:37 PM
Hello everyone,
I'm using CAP(Node.js) with odata(v4) & fiori elements. I am creating a custom add button so that user can add multiple values from valuehelp to draft rather than using the create button which allows you to create only one entry at a time. As we know that you can't use associations as an input parameter of custom actions, So I have been using a workaround for it. Create a type in cds service file with a field that has type array of string i.e type customType{someField : array of String}, Use this field as an input parameter i.e. action someAction( someField: customType : someField), And then assigning a valueHelp to this field through annotations.
This works fine if the associated entity has only one key. But if the associated entity has two key fields i.e. composite key, there doesn't seem to be a way to store both the keys from the valueHelp. Any ideas on how to achive this ?
I used the following blog to implement this work around (6. Action with Value Help Input) :
Request clarification before answering.
I think essentially it's doing the same thing that my approach does. You have assigned the action a valuehelp and storing the data in a string field
AuthorisationType : String(30)
And then in the JS file you are creating a draft for that entity with the inputed data. But if you assign the action's input type a field that is an association field i.e.
someAction(inp : someEntity : associationFeildOfThatEntity)
Or any variation of this it will give you an error. The issue is that if the associated entity i.e. the entity in the Collection path of the value help has a composite key then that means that every single column has values that are repeating, And if the user tries to select multiple values , it will only let you select those that have different values in the field
ValueListProperty
Thus ignoring some of the values .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.