Add one spot to a value - xamarin

Its possible to book appointments in my app and I get the queue line value from this code to display for the users in the app:
Text = $"Spot {_Class.Slots.WaitList}";
What im trying to get here is to show the queue that person has. The issue is that the value im getting from that line is the value that says how many people there are in the line. So if a person books an appointment the value has to increase from e.g 2 to 3.
EDIT:
The value im getting from this code I get from the database:
Text = $"Spot {_Class.Slots.WaitList}";
The value is 1 (just an example) but i need the value to be +1 every time.
I tried to do this:
Text = $"Spot {_Class.Slots.WaitList + "1"}";
But it added 10 instead of 1.

What's the type of WaitList field/property?
I don't see a reason why this wouldn't work:
Text = $"Spot {_Class.Slots.WaitList + 1}";

Related

IMPORTXML To Return a Value from dividendhistory.org

I want to return the value of "Yield:" from a series of stocks from a URL dividenhistory.org, for example HDIF into a Google sheet using IMPORTXML, where F7 represents the user supplied ticker.
=IMPORTXML("https://dividendhistory.org/payout/TSX/"&F7, "/html/body/div/div[2]/div[2]/p[4]")
The problem with the above is the yield value is not always located in the same paragraph, depending on the ticker. It also returns with the word "Yield:" as part of the value.
I believe I should be using the XPATH parameter which should find and return the yield value only, but I am lost. I am open to all suggestions!
I tried with a few of the tickers there, and this should work. For example:
=IMPORTXML("https://dividendhistory.org/payout/ctas/", "//p[contains(.,'Yield')]/text()")
Output:
Yield: 1.05%
Obviously, you can change 'ctas' for any user input.
Try this and see if it works on all tickers.
EDIT:
To get only the number 1.05, you need to split the result and output the 2nd part:
=index(split(IMPORTXML("https://dividendhistory.org/payout/ctas/", "//p[contains(.,'Yield')]/text()"), ": "),2)
Output:
0.0105

vars.put function not writing the desired value into the jmeter parameter

Below is the code which i have been trying to address the below UseCase in JMETER.Quick help is appreciated.
Usecase:
A particular text like "History" in a page response needs to be validated and the if the text counts is more than 50 a random selection of the options within the page needs to be made.And if the text counts is less than 50 1st option needs to be selected.
I am new to Jmeter and trying to solve this usingJSR223 POST processor but somehow stuck at vars.put function where i am unable to see the desired number being populated within the V paramter.
Using a boundary extractor where match no 1 should suffice the 1st selection and 0 should suffice the random selection.
def TotalInstanceAvailable = vars.get("sCount_matchNr").toInteger()
log.info("Total Instance Available = ${TotalInstanceAvailable}");
def boundary_analyzer =50;
def DesiredNumber,V
if (TotalInstanceAvailable < boundary_analyzer)
{
log.info("I am inside the loop")
DesiredNumber = 0;
log.info("DesiredNumber= ${DesiredNumber}");
vars.put("V", DesiredNumber)
log.info("v= ${V}");
}
else{
DesiredNumber=1;
log.info("DesiredNumber=${DesiredNumber}");
vars.put("V", "DesiredNumber")
log.info("v= ${V}");
}
def sCount = vars.get("sCount")
log.info("Text matching number is ${sCount_matchNr}")
You cannot store an integer in JMeter Variables using vars.put() function, you either need to cast it to String first, to wit change this line:
vars.put("V", DesiredNumber)
to this one
vars.put("V", DesiredNumber as String)
alternatively you can use vars.putObject() function which can store literally everything however you will be able to use the value only in JSR223 Elements by calling vars.getObject()
Whenever you face a problem with your JMeter script get used to look at jmeter.log file or toggle Log Viewer window - in absolute majority of cases you will find the root cause of your problem in the log file:

get text with index number and then compare with the expected text

I need to write a method which will get text with the help of index number from popup and then i need to compare with the expected text
i.e i need to verify expected plan name is displayed at the bottom of the popup box
Setting the correct id for the query (which you can get by doing on calabash console the command query("*", :id)) on code below should do the trick. If you can't use id try to get another component property (like Android component by using query("*") ) and set the query inside theget_text calls.
def get_text(query)
query(plan_query, :text).first
end
def text_equals(text, expected_text)
unless text == expected_text
fail "#{text} not equal to #{expected_text}"
end
end
def verify_plan(index, expected_text)
plan_text = get_text("* id:'PLAN_TEXTS_ID' index:#{index}") # Can change 'id:...'' by Android class if plan does not have id
expected_text = get_text("* id:'BOTTOM_PLAN_ID'") # Same as above
text_equals(plan_text, expected_text)
end

SendKeys() is adding default value (issue) + datetime value sent

basically the issue is taking place at the moment when I send some value which is appended to a default value '01/01/2000' somehow. I've tried different ways to do this without succeed, I've used these exact lines in other script and it worked but I don't know why this isn't working here. Please find below the last code I used followed by the picture with the issue displayed.
var targetStartDate = browser.driver.findElement(by.id('StartDate'));
targetStartDate.clear().then(function () {
targetStartDate.sendKeys('09/01/2016');
})
example of the issue
Thanks in advance for any response.
You can try issuing clear() call before sending keys:
targetStartDate.clear();
targetStartDate.sendKeys('09/01/2016');
The other option would be to select all text in the input prior to sending keys:
// protractor.Key.COMMAND on Mac
targetStartDate.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, "a"));
targetStartDate.sendKeys('09/01/2016');
I have encountered this same issue before. There is an input mask formatting the input in the field. In order to solve this, you must write your test as if it were the actual user, with the formatting in mind:
var targetStartDate = browser.driver.findElement(by.id('StartDate'));
// Remove the forward slashes because the input field takes care of that.
var inputDate = '09012016';
targetStartDate.clear();
// Loop through each character of the string and send it to the input
// field followed by a delay of 250 milliseconds to give the field
// enough time to format the input as you keep sending keys.
for (var i = 0; i < inputDate.length; i++) {
targetStartDate.sendKeys(inputDate[i]);
browser.driver.sleep(250);
}
Depending on the latency of the site and performance, you may either need to decrease the 250 millisecond delay, or be able to decrease it.
Hope this helps!

Exception while adding TimeScaleValue MS Project

I'm getting this exception in this code:
Dim TSV As TimeScaleValues
TSV = ActiveProject.Task(ntask).Resources(nresource).TimeScaleData(nStartDate , nEndDate, PjResourceTimescaledData.pjResourceTimescaledActualWork, PjTimescaleUnit.pjTimescaleDays, 1)
TSV.item(1).Add( nMinutes , 1 ) ' nMinutes is the value of time in minutes. The error occours in this line !!!!
When I execute the last line I get this exception
Invalid value for argument.
Error code -2146827187
{Microsoft.Office.Interop.MSProject.TimeScaleValue Add(System.Object, System.Object)}
The estrange thing is that I got this example right from this microsoft reference page.
What I'm trying to do is add a time to time scale on project.
I solved the problem.
I was setting the value in the wrong place.
Seems confuse, but I was trying to get the time scale value from resource, but the right place to set the values is on assignments.
I was doing this..
TSV = ActiveProject.Task(ntask).Resources(nresource).TimeScaleData...
The right code is like:
TSV = ActiveProject.Assignments.TimeScaleData..
For each resource in the task is created one assingment, so teh final code is like:
For Each assignment As Assignment In Task.Assigments
if assignment.Resource.WindowsUserAccount = <desiredAccount> then
tsv = assingment.TimeScaleData..
end if
Next

Resources