Hi @cv2qm ,
It sounds like you want to write a value back to your SQL table and something is not working right for you. I pasted your formula here using the </> button in the toolbar:
Patch(
'[dbo].[Table]',
{
STUDENT_ID: ComboBox1.Selected.STUDENT_ID,
AWARD: Value(TextInput1_3.Text),
AMOUNT: Value(TextInput1_2.Text)
}
)
The patch function attempts to convert whatever is in the label into a number as best as it can. In the case of 2368, the conversion is easy because it's already a number. In the case of DR0977, the number is not picked out as well.
You can test this out. Insert a label and set its text as below to see what would return:
Value("DR0977")
Instead, it may be most accurate to retrieve the digits by using the Match() function. It uses regex which is very powerful, and there are some out of the box patterns you can use without need to memorize any regex. Here's an example that would retrieve the digits:
Value(Match("DR0977",Match.MultipleDigits).FullMatch)
This means, "Look for a pattern of multiple digits in the string and return a record containing the full match, sub matches, and an integer representing where the match was found. But from that record, only return the fully matched string. Then convert that match, which is a string, to a value instead."
In context, this is how it might look:
Patch(
'[dbo].[Table]',
{
STUDENT_ID: ComboBox1.Selected.STUDENT_ID,
AWARD: Value(Match(TextInput1_3.Text,Match.MultipleDigits).FullMatch),
AMOUNT: Value(TextInput1_2.Text)
}
)
Let me know if this helps. 👍