cancel
Showing results for 
Search instead for 
Did you mean: 

Answering subsequent prompts/contexts

Former Member
0 Kudos

Hello,

I am doing remapping of data providers to a new data source. Some of the documents require parameters for contexts or prompts to be answered for the data provider to be remapped.


I have used the - GET /raylight/v1/documents/<docId>/parameters call to get the answers for the parameters.  However, I've found that many times that when I POST the remappings with these parameters, a new set of parameters are returned. These set of parameters do not appear in the /raylight/v1/documents/<docId>/parameters call. I am not able to programmatically answer the second set of parameters because I cannot get the answers through the /raylight/v1/documents/<docId>/parameters call.


Is there a way to get the previous answers for these subsequent required parameters?


Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I just determined that I can get back a specific parameter by entering an id on the end of the parameters call. I am able to get the subsequent parameter answers this way, but since the id's don't match the id's of the parameters in the mappings call, it's not the greatest help to me. I suppose the only time this would really affect me is when there are multiple contexts - I wouldn't be able to easily ascertain which context is which. Any advice is still appreciated.

eric_festinger
Contributor
0 Kudos

hello Ryan

Could you please give an example?

Thanks and regards,

eric

Former Member
0 Kudos

Sure.

So I make a raylight/v1/documents/<docId>/dataproviders/mappings POST with the mappings I get from the initial GET. I receive back the mapping with the initial parameter - in this case a context:

{

  "mappings": {

    "content": {

      "mapping": [<mappings>

      ]

    },

    "parameters": {

      "parameter": {

        "@dpId": "DP2",

        "@type": "context",

        "@optional": "false",

        "id": 3,

        "technicalName": "cCombined Query 1",

        "name": "Select a context",

        "answer": {

          "@type": "Text",

          "@constrained": "true",

          "info": {

            "@keepLastValues": "true",

            "@cardinality": "Single",

            "lov": {

              "@mandatorySearch": "false",

              "@searchable": "true",

              "@refreshable": "true",

              "@partial": "false",

              "@hierarchical": "false",

              "values": {

                "value": [

                  {

                    "@description": "This context should be used when interested in Expense related data by both historical and current Project information.  (Only projects submitted on Expenses will display)\r\n",

                    "@id": "CTX_16",

                    "$": "Historical Project & Expense Rep"

                  },

                  {

                    "@description": "This context should be used when interested in Timesheet related data by both historical and current Project information.  (Only Projects submitted on Timesheets will display)\r\n",

                    "@id": "CTX_15",

                    "$": "Historical Project & TS Rep"

                  },

                  {

                    "@description": "This context should be used when interested in Timesheet and/or Expense related data for current Projects associated to engaged candidates.  (Only current projects in which have been submitted for a Timesheet or Expense will display).",

                    "@id": "CTX_17",

                    "$": "TS & Expense Rep (by current Proj)"

                  }

                ]

              }

            }

          }

        }

      }

    }

  }

}

Using the raylight/v1/documents/<docId>/parameters/ call I get the answer:

{

  "parameters": {

    "parameter": {

      "@dpId": "DP0",

      "@type": "context",

      "@optional": "false",

      "id": 0,

      "technicalName": 0,

      "name": "Select a context",

      "answer": {

        "@type": "Text",

        "@constrained": "true",

        "info": {

          "@keepLastValues": "true",

          "@cardinality": "Single",

          "lov": {

            "@mandatorySearch": "false",

            "@searchable": "true",

            "@partial": "false",

            "values": {

              "value": [

                {

                  "@description": "This context should be used when interested in Expense related data by both historical and current Project information.  (Only projects submitted on Expenses will display)\n",

                  "@id": "16",

                  "$": "Historical Project & Expense Rep"

                },

                {

                  "@description": "This context should be used when interested in Timesheet related data by both historical and current Project information.  (Only Projects submitted on Timesheets will display)\n",

                  "@id": "15",

                  "$": "Historical Project & TS Rep"

                },

                {

                  "@description": "This context should be used when interested in Timesheet and/or Expense related data for current Projects associated to engaged candidates.  (Only current projects in which have been submitted for a Timesheet or Expense will display).",

                  "@id": "17",

                  "$": "TS & Expense Rep (by current Proj)"

                }

              ]

            }

          },

          "previous": {

            "value": {

              "@description": "This context should be used when interested in Timesheet related data by both historical and current Project information.  (Only Projects submitted on Timesheets will display)\n",

              "@id": "15",

              "$": "Historical Project & TS Rep"

            }

          }

        },

        "values": {

          "value": {

            "@description": "This context should be used when interested in Timesheet related data by both historical and current Project information.  (Only Projects submitted on Timesheets will display)\n",

            "@id": "15",

            "$": "Historical Project & TS Rep"

          }

        }

      }

    }

  }

}

I POST the context parameter answer with the mappings, and I get back the set of mappings again with more parameters:

{

  "mappings": {

    "content": {

      "mapping": [<mappings>

      ]

    },

    "parameters": {

      "parameter": [

        {

          "@dpId": "DP2",

          "@type": "prompt",

          "@optional": "false",

          "id": 4,

          "technicalName": "psEnter Period Start Date:",

          "name": "Enter Period Start Date:",

          "answer": {

            "@type": "DateTime",

            "@constrained": "false",

            "info": {

              "@keepLastValues": "true",

              "@cardinality": "Single"

            }

          }

        },

        {

          "@dpId": "DP2",

          "@type": "prompt",

          "@optional": "false",

          "id": 5,

          "technicalName": "psEnter Period End Date:",

          "name": "Enter Period End Date:",

          "answer": {

            "@type": "DateTime",

            "@constrained": "false",

            "info": {

              "@keepLastValues": "true",

              "@cardinality": "Single"

            }

          }

        }

      ]

    }

  }

}

As I posted in my answer, I am able to get the answers to these prompts by specifying the id on the parameters call, e.g. raylight/v1/documents/<docId>/parameters/1 and raylight/v1/documents/<docId>/parameters/2

It would seem that calling raylight/v1/documents/<docId>/parameters/ without an id is the same as providing id of 0? This aspect doesn't appear to be well-documented. Nonetheless, by calling parameters with an id I am able to get the answers:

{

  "parameter": {

    "@dpId": "DP0",

    "@type": "prompt",

    "@optional": "false",

    "id": 1,

    "technicalName": "Enter Period Start Date:",

    "name": "Enter Period Start Date:",

    "answer": {

      "@type": "DateTime",

      "@constrained": "false",

      "info": {

        "@keepLastValues": "true",

        "@cardinality": "Single",

        "previous": {

          "value": "2012-05-31T20:00:00.000-04:00"

        }

      },

      "values": {

        "value": "2012-05-31T20:00:00.000-04:00"

      }

    }

  }

}

I can just call each of the id's sequentially until I find one where the name matches the parameter I am currently trying to answer. The only place this fails would be when there are multiple contexts - the name of the parameter would be the same in each case. I suppose I can assume that the contexts will be in sequential order based on id though, right? For example, the mappings call returns a parameter calling for a context. Say I make a parameters/0 and a parameters/1 call and they are both contexts. I can assume that the context with id 0 will be the first context. I POST that answer and get back a second context parameter. I can assume that context will be the context with id 1. Correct?

eric_festinger
Contributor
0 Kudos

hello Ryan

"It would seem that calling raylight/v1/documents/<docId>/parameters/ without an id is the same as providing id of 0?" --> No. "/parameters/" without an id get all available (at this time of the workflow) parameters of the document, or the dataprovider, or ...

"I suppose I can assume that the contexts will be in sequential order based on id though, right?" --> A little bit of yes as we actually increment the parameter id when we discover a new one, but no: we do not guarantee, and I guess we won't ever guarantee, any specific order for the parameters! Please do consider them just as identifiers, which could be any kind of data, We only guarantee that the ids returned by a GET parameters or a previous PUT parameters will be ok to refresh your document, or dataprovider, or LOV, or...

The documentation should state something like that about contexts: "You must first answer the context before answering the subsequent returned prompt. If no context is provided, the document cannot be refreshed, and the response of the PUT call contains the details about the context parameter."

It is exactly the same thing with BI LaunchPad when you try to refresh your WebI document: it first shows a popup with the first context, then the 2nd context if any, then the 3rd etc. and then, at least, the prompts.

To mimic this with "Web Intelligence RESTful web service" in the case of 2 contexts + prompts :

1. GET parameters --> returns the 1st context.

2. PUT parameters with the answer to the 1st context as request body --> returns the 2nd context

3. PUT parameters with the answers to the 1st and 2nd contexts as request body --> returns the prompts.

4. PUT parameters with the answers to the 1st and 2nd contexts + prompts as request body --> the document should be refreshed.

Is that a bit clearer?

eric

Answers (0)