Hello I have a barcode scanner that scans a qr code. Then it extracts some values.
I then have a label that holds the value. I want to make a function that says "If the field its empty assign variable1 if the fields its not empty do First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value)
How can i perform this ? I tried with If(IsBlank(Label2.Text);"variable1";First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value)
But it gives error
Solved! Go to Solution.
Hi @langsem ,
Thank you for your information.
I assume:
You could try the following code:
If(" " in First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value),"variable 1",First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))
Best Regards,
Wearsky
Hi @langsem ,
You could try this code:
If(IsBlank(Trim(First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))),"variable 1",First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))
// Trim function can delete all spaces in a text string, except for a single space between words.
Best Regards,
Wearsky
@langsem wrote:
I want to make a function that says "If the field its empty assign variable1 if the fields its not empty do First(Match(BarcodeScanner1.Value;"FORSIKRING:
To do this you must already have the variable set OnVisible or somewhere at the beginning first
OnVisible Screen1
Set(_Variable01;"")
Where are you using the longer formula (on which property, and on what kind of thing is it on)?
For the longer formula, you can try something like this
If(IsBlank(Label2.Text);Set(_Variable01;"somethingGoesHere");false)
For the part that says false above, you would try your longer sub formula here
First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value)
but before you try that longer one - if the longer one gives an error, put something easier there so you can test it. If false also gives an error, try an empty string, or some other mock value that matches the context of where you are using this whole formula.
Check if something like the above helps.
Hm dident get a error, but also it dident work. Its still just shows blank
Hi @langsem ,
Could you tell me:
I assume:
I've made a test for your reference:
1\ Set label2’s Text property to:
If(IsBlank(BarcodeScanner1.Value),"variable 1", First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))
Best Regards,
Wearsky
almost. The BarcodeScanner1.Value contains alot of text so the code
First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value).
Splits that value and place it into labels.
So I need to check if Label2 contains text after the barcode scan has been made. If the code above dont have a value i want to fill the Label2 with some text. I cant check if the Barcodescanner1.value has a value because it will always have some form of value, have to check after it splits the value of the Barcodescanner1.value
Hi @langsem ,
According to your description, I modified the formula.
You could try the following code:
If(IsBlank(First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value)),"variable 1",First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))
Firstly, split BarcodeScanner1.Value .
Secondly, determine whether the required part is empty.
If it is empty, label2 displays "variable 1".
If it is not empty, label2 displays the value of the required part.
Best Regards,
Wearsky
I think we are close, is it possible to check if it contains whitespace? Because i am still getting a blank field, so I assume the value its whitespace or something ?
Hi @langsem ,
According to your description, I think the formula executes First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value).
Could you tell me:
What is the value of BarcodeScanner1.Value?
And What is the value returned by First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value) ?
Best Regards,
Wearsky
the barcodescanner value its
a dynamic value
but in general it is
SO:00005554
REG:EB23335
FORSIKRING:TRYG
JOBB:4
LAGERSTED:80
So the code First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value) splits the total value and retrieves TRYG, BUT sometimes the fields its blank. So in a case that i have now its returning just whitespaces
Hi @langsem ,
Thank you for your information.
I assume:
You could try the following code:
If(" " in First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value),"variable 1",First(Match(BarcodeScanner1.Value;"FORSIKRING:(.+)";Contains).SubMatches).Value))
Best Regards,
Wearsky
User | Count |
---|---|
256 | |
107 | |
90 | |
51 | |
44 |