cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

with out refresh button how to generate random values

dcbb
1-Visitor

with out refresh button how to generate random values

Hi

  Actually when I ran the java sdk code the properties values reflect in thing ,i mean generate random values.

in Mashup values generate. But my thing i want to generate the values in Properties through Java Sdk.

8 REPLIES 8
supandey
19-Tanzanite
(To:dcbb)

Have you considered writing a random number generator function in Java which you can call in the processScanRequest() via a setProperty(), thus every time the scan is performed the function will have a random number to set in the property in the Java SDK.

int temp = <value>;

write getter and setter for temp property and in the processScanRequest() you can call this setter(). Therefore, whenever the updateSubscribedProperties(); is called the temp property should have a new value

Hope this helps.

dcbb
1-Visitor
(To:supandey)

I am writing like this

public void processScanRequest() throws Exception {

  super.getProperty("CompressionRate");

  super.getProperty("UniversalInput");

  super.getProperty("Inputvolt");

// Be sure to call the base classes scan request

super.processScanRequest();

// Execute the code for this simulation every scan

this.scanDevice();

}

// Performs the logic for the steam sensor, occurs every scan cycle

public  void scanDevice() throws Exception {

double compressionRate = 1+20*Math.random();

double universalInput = 2+20*Math.random();

double inputvolt = 1+20*Math.random();

String currentStatus = "Float";

String equipmentType = "Active";

String controllerType = "Float";

super.setProperty("CompressionRate",compressionRate);

super.setProperty("UniversalInput",universalInput);

super.setProperty("Inputvolt", inputvolt);

super.setProperty("CurrentStatus", currentStatus);

super.setProperty("EquipmentType", equipmentType);

super.setProperty("ControllerType", controllerType);

//System.out.println("@@## came to scanDevice method ");

super.updateSubscribedProperties(15000);

super.updateSubscribedEvents(60000);

}

dcbb
1-Visitor
(To:dcbb)

it is ok,,can you reply me

dcbb
1-Visitor
(To:dcbb)

How to stop the Overlap in Mashup


Hi

  Can you please tell me how to stop the Overlap in Mashup,I mean i have created dashboard, in dashboard the gadget overlap so i have to stop the overlap


  tell me Please

supandey
19-Tanzanite
(To:dcbb)

Please start a new thread for this question, I don't see how this is connected to your "with out refresh button how to generate random values" question

dcbb
1-Visitor
(To:dcbb)

Dashboard.JPEG

See I Have created the Dashboard but here it is Overlapping the gadgets(Dashboard) but my requirement don't change position.How is it possiable or we can't do, Please tell me About dashboard.I saw the some videos they told They can add or remove gadgets, reposition gadgets on the page, and relocate gadgets to other tab like this.

dcbb
1-Visitor
(To:dcbb)

Hi

i want don't change position, How

Can you please tell me About dashboard image

supandey
19-Tanzanite
(To:dcbb)

You are calling all the right functions so it should be working(not sure if it's the complete code). Is there specific reason as to why you are calling super for all the properties?

Nonetheless, where is the problem? Does that not work for you? I don't see any additional code on Events so not sure why you calling the updateSubscribedEvent() , if you only have the properties it should be sufficient to use the super.updateSubscribedProperties();

Announcements


Top Tags