<screen scraping in uipath> combine split numbers - vb.net

I would like to screen scrape a few user details including the handphone no. from one application and paste the details into another application. There's a spacing in the handphone no. e.g. 8123 4567. I would like to remove the spacing and paste 81234567 into the other application.
I have use Build Data Table and Write Range to store the captured information in. In the handphone no. screen scrape activity, I did the following additional steps to split the numbers and combine them into 1. It works the first few times but when I tried running the script a few days later, it stopped working. Basically, the handphone no. is not completely copied over. Sometimes it returns as 8123 and sometimes as 812.
Assign
ArrayHandphoneNo = HandphoneNo.Split({" "},stringsplitoptions.None)
Assign
HandphoneNo = ArrayHandphoneNo(0)
Try Catch
HandphoneNo = HandphoneNo + ArrayHandphoneNo(1)
Catches exception
Assign
HandphoneNo = HandphoneNo
May I know what went wrong?

Why you having a workaround. From my perspective you simply need a line of code that is removing all spaces. So you get back the full digit number. So try with this:
myString = myString.Replace(" ", "")
in your assign activity.
Could look like this one:

Related

Extract portion of HTML from website?

I'm trying to use VBA in Excel, to navigate a site with Internet explorer, to download an Excel file for each day.
After looking through the HTML code of the site, it looks like each day's page has a similar structure, but there's a portion of the website link that seems completely random. But this completely random part stays constant and does not change each time you want to load the page.
The following portion of the HTML code contains the unique string:
<a href="#" onClick="showZoomIn('222698519','b1a9134c02c5db3c79e649b7adf8982d', event);return false;
The part starting with "b1a" is what is used in the website link. Is there any way to extract this part of the page and assign it as a variable that I then can use to build my website link?
Since you don't show your code, I will talk too in general terms:
1) You get all the elements of type link (<a>) with a Set allLinks = ie.document.getElementsByTagName("a"). It will be a vector of length n containing all the links you scraped from the document.
2) You detect the precise link containing the information you want. Let's imagine it's the 4th one (you can parse the properties to check which one it is, in case it's dynamic):
Set myLink = allLinks(3) '<- 4th : index = 3 (starts from zero)
3) You get your token with a simple split function:
myToken = Split(myLink.onClick, "'")(3)
Of course you can be more synthetic if the position of your link containing the token is always the same, like always the 4th link:
myToken = Split(ie.document.getElementsByTagName("a")(3).onClick,"'")(3)

#Dblookup and formatting on web

I have been developing a web application using domino, therein I have dblookup-ing the field from notes client; Now, this is working fine but the format of value is missing while using on web.
For example in lotus notes client the field value format is as above
I am one, I am two, I am one , I am two, labbblallalalalalalalalalalalalalalalalalalaallllal
Labbbaalalalallalalalalalaalallaal
Hello there, labblalalallalalalllaalalalalalalalalalalalalalalalalalalalalalalala
Now when I retrieve the value of the field on web it seems it takes 2 immediate after 1. and so forth, I was expecting line feed here which is not happening.
The field above is multi valued field. Also on web I have used computed text which does db lookup from notes client.
Please help me what else could/alternate solution for this case.
Thanks
HD
Your multi-valued field has display options associated with it and the Notes client honors those. Obviously, your options are set up to display entries separated by newlines.
The computed text that you are using for the web does not have options like that and the field options are irrelevant because you aren't displaying the field. Your code has to insert the #Newlines. That's pretty easy because #DbLookup returns a list, and if you concatenate a list and a scalar, the scalar will be appended to each element of the list. (Look at the third example under "concatenation, pairwise" here to see what I mean.
The way you've worded your question is a little unclear to me, but what you need in your computed text formula is either something like this:
list := #DbLookup(etc,. etc.);
list + #Newline;
Or something like this:
multiValueFieldContainingListWithDbLookupResult + #NewLine;
I used #implode(Dblookupreturnedvalue;"");
thanks All :)

Infinite Addition Loop

I basically have 4 tags that keep a count of product produced within the company. The problem is that the logic behind these tags is to reset the value when the machine stops. I am not too familiar with coding, but am trying to develop a calculation tag that will just keep a running count without reset. So basically, the number would always escalate.
Tag Names : Filler1Count , Filler2Count, Filler3Count, Filler4Count
This is all done in an application called Historian Administrator. VB code can be implemented behind tags. I will obviously be keeping the original tags, but have the option of making a calculation tag.
Watch for when the number is smaller than the previous poll and store your total in a different variable.
If Filler1Count < LastFiller1Count Then
Filler1Total = Filler1Total + LastFiller1Count
End If
LastFiller1Count = Filler1Count
Total = Filler1Total + Filler1Count

PsychoPy Builder - How to I take a rest part way through a set of trials?

In PsychoPy builder, I have a lot of trials and I want to let the participant take a rest/break part way through and then press SPACE to continue when they're ready.
Any suggestions about how best to do this?
PsychoPy Builder uses the TrialHandler class and you can make use of its attributes to do control when you want to take a rest.
Assuming you're trial loop is utilising an Excel/csv file to get the trial data then make use of trialHandler's attribute : thisTrialN
e.g.
1/ Add a routine containing a text component into your loop (probably at the beginning) with your 'now take a rest...' message and a keyboard component to take the response when they are ready to continue.
2/ Add a custom code component as well and place something similar to this code into its "Begin Routine" tab:
if trials.thisTrialN not in [ int(trials.nTotal / 2) ]:
continueRoutine=False
where 'trials' is the 'name' of your trial loop.
The above will put a rest in the middle of the current set of trials but you could replace it with something like this
if trials.thisTrialN not in [10,20]:
continueRoutine=False
if you wanted to stop after 10 and again after 20 trials.
Note, if you're NOT using an Excel file but are simply using the 'repeat' feature of a simple trial loop, then you'll need to replace thisTrialN with thisRepN
If you're using an Excel file AND reps you'll need to factor in both when working out when you want to rest.
This works by using one of Builder's own variables - continueRoutine and sets it false for most trials so that most of the time it doesn't display the 'take a rest' message.
If you want to understand more, then use the 'compile script' button (or F5) and take a look at the python code that Builder generates for you.

How to get OrderNumber in Sage Accpac after entering order with macro script

I have recorded the process to create an order and quote in Sage ACCPAC, and i put the code in a VB 6 application, it works perfectly and adds a new quote / order. But what i need is that i want to get the generated ordernumber or orduniq within the same code , I want to perform some operations on that quote. But i am not sure, how can i get the information from accpac, as what i have done till now is simply recorded a macro and then copied the code and put it into VB application. I got the session creating code from a site, and made the Macro code dynamic and the application is ready to accept parameters and create an order on that basis , Kindly tell me how can i return the created ordernumber back to the user.
Thanks
Agree with enterland - always good to post code here. However, in this case I know what you're looking for. Once you create the order you can get the order number from your order header view. Along these lines:
OEOrderHeader.Insert
NewOrderNumber = OEOrderHeader.Fields("ORDNUMBER").Value