10 Replies Latest reply on May 23, 2017 2:52 AM by supandey Branched to a new discussion. RSS
    rvuta Explorer

    GetNamedPropertyValues service throwing error

    Hi everyone,


    I am trying to get property values of thing by passing property names dynamically.

    Using GetNamedPropertyValues service to achieve this.

    I am passing two column names to service,but its considering one more empty column and throwing error like below.


    Wrapped com.thingworx.common.exceptions.InvalidRequestException: Property [null] not found in [Plant 32] Cause: Property [null] not found in [Plant 32]

    Plant 32 is my "Thing" name

    sharing my code snippet ,Please suggest me where I am doing wrong.



    var params_1 = {
      infoTableName : "InfoTable",
      dataShapeName : "ProdInfoColmn_DS"
    // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(ProdInfoColmn_DS)
    var result_info = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params_1);
       var  newRow = new Object(); 
        newRow.TargetQuantity = "TargetProduction_A";
        newRow.ActualQuantity = "Production_A";
    /*var fieldName = null;
    var params = {
      propertyNames: result_info /* INFOTABLE */
    var result = Things["Plant 32"].GetNamedPropertyValues(params);

    Appreciate your help..





    Message was edited by: Sushant Pandey

      • Re: GetNamedPropertyValues service throwing error
        supandey Collaborator

        Hi Raji, how does the DataShape look like which is being assigned to the "InfoTable"

          • Re: GetNamedPropertyValues service throwing error
            rvuta Explorer

            Hi Sushant,

            Datashape is also having only two properties.

            sharing screenshot of datashape.

            Also cross checked infotable level also.its having only two columns.







              • Re: GetNamedPropertyValues service throwing error
                supandey Collaborator

                Raji I think the issue here is that you are passing the values for the property to the GetNamedPropertyValues where as it's expecting Infotable which contains the DS that holds the PropertyName. You can check this by testing the GetNamedPropertyValues service and you'll see as an input it requires you to enter the propertyName and description. In which PropertyName is a mandatory field.


                So you'll need to pass such an Infotable and the values that you want to insert and I think the PropertyNames should match to the PropertyName you have in Thing

                  • Re: GetNamedPropertyValues service throwing error
                    supandey Collaborator

                    Here's a quick demo


                    1. Created a Infotable with DS that has filed name and description, of course you don't have to create a property with Infotable like this you can simply create that in your script


                    2. Here's how my service looks like :

                    var params = {
                      propertyNames: me.PropertyForGetPropertyValues /* INFOTABLE */
                    // result: INFOTABLE dataShape: "undefined"
                    var result = me.GetNamedPropertyValues(params);

                    3. Do note that my returned output contains the DS which matches with the required Output for my data, like so


                    Hope this will help.

                    • Re: GetNamedPropertyValues service throwing error
                      rvuta Explorer


                      As per my understanding Infotable result should be the property names of my thing.

                      this propertynames values will pass to SQL service and gives result/values  of sql properties.


                      So I didn't understand why sql service will check for DataShape property names instead of values , which are same as Propertynames of my Thing.


                      pls correct me if I am wrong.




                        • Re: GetNamedPropertyValues service throwing error
                          supandey Collaborator


                          What I have explained above is the usage of GetNamedPropertyValues which will produce following result and as to why you are getting that error.

                          Your understanding is right that the returned Infotable will give you the PropertyValues however the reason why you should be particular about the DS is because the Infotable produced as the Output must give you the values with correct dataType. And same applies for the Infotable you are inputting because the GetNamedPropertyValues expects you to give input in certain type of DataShape which is Name and Description both of string baseType. Of course once you have the values you are free to use them in any other service such as the SQL script.