Forum Discussion

amarnath1234's avatar
amarnath1234
Contributor
6 years ago

data source query

Hi Team,

 

I have a scnerio where I need to fetch request data from data source and sink the response data in source file.my data is as below.so for below 4 fields we have differenct scnerios in a excel sheet and i tried to feetch excel sheet data into request like-${DataSource#LifeCycle},${DataSource#LifeStage},${DataSource#Loyalty_ID},${DataSource#PLCC_ID} in request.

below are the fields:-

LifeCycle:1

LifeStage:2

LoyaltyIndicator:true

PLCCIndicator:false

when i send this request I got 1 error as-

"Error 500: javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of boolean from String value '': only "true" or "false" recognized
at [Source: com.ibm.ws.webcontainer.srt.http.HttpInputStream@8813ee4a&#59; line: 38, column: 10] ",observed that error is due to LoyaltyIndicator,PLCCIndicator fields.

 

so my question is how i fetch this 2 fields data with data source in my request,is it the right approch-${DataSource#Loyalty_ID},${DataSource#PLCC_ID} ?

  • Hi Amarnath,

     

    Could you please try below approach for the issue:-

    1. Format the excel cell and set as "Text". -> Right click on the cell->Format Cells->From Category->Select Text.
    2. And then in groovy code:- String localtyID = ${DataSource#Localty_ID}.

    Hope, this can help you out. Let me know after you try this approach and send the screenshot of the error you get.

  • avidCoder's avatar
    avidCoder
    Super Contributor

    Hi Amarnath,

     

    Could you please try below approach for the issue:-

    1. Format the excel cell and set as "Text". -> Right click on the cell->Format Cells->From Category->Select Text.
    2. And then in groovy code:- String localtyID = ${DataSource#Localty_ID}.

    Hope, this can help you out. Let me know after you try this approach and send the screenshot of the error you get.

  • KonstantinosLps's avatar
    KonstantinosLps
    Occasional Contributor

    Hi,

    i don't know if this helps, but have you tried convertion boolean "true" and "false" to string?

     

    boolean PLCCIndicator = true;
    String str = String.valueOf(PLCCIndicator);

     

    Then use the "str" as you wish.

     

    Regards

    -Konstantinos