Git Product home page Git Product logo

Comments (2)

VidyasagarMSC avatar VidyasagarMSC commented on May 20, 2024

@nizamudeenms What data are you referring to? Can you highlight the line number in the code?

from watbot.

nizamudeenms avatar nizamudeenms commented on May 20, 2024

I mean my own data retrieved from Database

EG: in node js you send data like this ....


var ConversationV1 = require('watson-developer-cloud/conversation/v1');

var conversation = new ConversationV1({
  username: 'username',
  password: 'password', 
  path: { workspace_id: 'workspaceID' },  
  version_date: '2017-31-05'
});

var context; 

conversation.message({}, processResponse);


function processResponse(err, response) {
  if (err) {
    console.error(err); 
    return;
  }
  
  if (response.output.text.length != 0) {
      	console.log(response.output.text[0]);
//	console.log(response);

	if( response.output.text[0].indexOf("Checking traffic fines") > -1 || response.output.text[0].indexOf("checking traffic fines") > -1 ) {
		console.log("You have 600 Qatari Riyals of Traffic Fines");
		context = response.context;
		context.fines = "yes";

	 	conversation.message(
		{
			input: {},
			context: context
		}
		,processResponse
		);			
	}

	context = response.context; 
  }
}

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    // note:  d is an object, and when converted to a string it will
    // end with a linefeed.  so we (rather crudely) account for that  
    // with toString() and then trim() 
    console.log("you entered: [" + 
        d.toString().trim() + "]");

    conversation.message(

		{
  			input: {text: d.toString().trim()},
			context: context 
		}

		, processResponse); 

  });

In the above code, this block is validating if user has fines, appends 'fines' variable to context and sends 'fines' variable in the Blumix server. If I run this node js code in local console its giving the the proper output but I don't know how to convert this code to java.

if( response.output.text[0].indexOf("Checking traffic fines") > -1 || response.output.text[0].indexOf("checking traffic fines") > -1 ) {
console.log("You have 600 Qatari Riyals of Traffic Fines");
context = response.context;
context.fines = "yes";
conversation.message(
{
input: {},
context: context
}
,processResponse
);

In my case the fines are retrieved from database and sent to blue mix.
I want to know how to send data 'fines' from java ... It should be read by blue mix....

Please tell me how can I append a variable 'fine' in java context and send it to blue mix in java.

It will better if you give me your mobile number to call you. . I have mailed you please share mobile no in mail...

from watbot.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.