Duplicating the data in a field into another field

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I have a text field that has information in it that I want it to automatically duplicate into another formula text field, is this possible?  What ever data goes into the first text field get automatically duplicated into the second formula text field

Photo of Derek

Derek

  • 30 Points

Posted 4 years ago

  • 0
  • 1
No problem.

Just make a formula text field  with the formula

[text field that has information in it]
Photo of Derek

Derek

  • 30 Points
This would be the acutal formula? [text field that has information in it].  Im not sure I understand
Well, you said that you had a text field that has information in it, but you did not give me the name of the field.  Let's says that is called Field 1.

Then the formula for the field called Field 2 which is a formula text field would be

[Field 1]

The field choices for building a formula can be pulled in from a drop down list on the right side of the formula box.
Photo of Derek

Derek

  • 30 Points
Oh ok great that is much easier than I thought.
Photo of Derek

Derek

  • 30 Points
Hi again, was wondering if you could help me with a formula.  I have several formula fields one named [Check In], [Check Out] and another named [Request status].  I want the [Request Status] field to change based on if the [Check In] field is = true and then the [Request Status] changed again when the [Check Out] is = true. The option in the [Request Status] fields are "requested", "shipped" and "returned".  I have tried many times but getting errors.  Here is an example of what I want to do but having trouble using the case formula.

[check in]=true, [request status] (shipped)
[check out]=true, [request status] (returned)

The default value is requested so that doesn't need a formula I don't think.

Thank you,
DP
Based on your post, It sounds like you want this.

IF(
[check out]=true, "Returned",
[check in]=true, "Shipped", "Requested")

But in my mind you have a backwards idea of what check in and check out mean, so I think that you really want....

IF(
[check in]=true, "Returned",
[check out]=true, "Shipped", "Requested")

Like a library book, you check it out when you borrow it and check it back in when you return it. But maybe you have a different Terminology.

Note that an IF statement processes the tests in sequence and stops checking when it finds the first true condition, so if the first test is not true, then it tries the second test, and if that is also not true then in this case it just defaults to the "else" which is the "Requested"
Photo of Derek

Derek

  • 30 Points
Thanks for this info, however I am getting this error. Basically in the [Test Kit - Check In] field I am using a scanner to scan barcode and if that field has the numbers of the barcode in the field I want the status to change to "Shipped or "Requested" and vise versa for when it's scanned back in.

The expression [Test Kit - Check In] on the left hand side of the operator "=" is of type text while the expression true on the right hand side is of type bool. The operator "=" cannot be used with these types of expressions.
Try this.  i had assumed form your post that these were checkbox fields, but they are text fields.  You will need to figure out which of those two fields to test first as I thin that first you check out and then check it.  So, you need to test if its checked back in, or then if it was checked out, or else its still just a request.

I do not suggest that you keep the bar code fields as numeric field, if they are long numbers.  I suggest treating them as text fields.  

IF(
Trim([check in]) <>"", "Returned",
Trim([check out])<>"", "Shipped", "Requested")

If the fields are numeric
IF(
[check in]>0 , "Returned",
[check out] > 0, "Shipped", "Requested")
Photo of Derek

Derek

  • 30 Points
Thanks the top formula works perfect! I have one more question.  Now that I have that setup if my two check in and check out fields are different is there a way to display an alert or change the color red?  For example if I scan at check out 12345 and when I check back in and scan 12555 is there a way to compare the two fields and provide a warning or somewsay of alerting the scanner what we check out isn't the same as what we are checking in?
The problem with the color coding is that the cursor will need to leave the field before the form will recognize the input.  Excel actually works the same way, you need to enter or tab out of a field before the sheet knows that you have completed your data entry.

Try a Dynamic form rule though.  I have not tested this but it should work.

When the record is saved
 and ALL of the following:
[check out] not equal (blank)  - ir just leave the field empty
[check in][ not equal (blank)\
[check in] not equal to the value in the field [check out]

Action:
Abort the save with message "Sorry, but the bar code checked out does not match the bar code checked in.  Please resolve and then try again."
Photo of Derek

Derek

  • 30 Points
Thanks I got that to work for single checkout, what if I'm scanning multiple items into one text field?  I scanned three different items into check out and scanned the three back in but Im getting my error message even though they are the same, is there a way to fix that?
Can you explain your relationships between your tables?  I find it odd what you are doing.  I would have assumed that you have a parent record for the item - let's call it a Library Book.  Then your child record would be the Book Requests.  The on each Request you woulds scan a single bar code out and then in again.

If you are saying that the items being scanned has three bar codes n it because the item is some kind of kit with three parts to it, then you should consider three separate scan fields to scan in, and three to scan out. Then we would need to beef up the formuals I suppose as you may not scan then in back to the same fields as when they were scanned out.

If, however, you still want to just use one field and also are prepared to ensure that the sequence of the scans out for that single input field matches the sequence of the scans in, then you could try to create two new fields called

[Trimmed scan in] and [Trimmed scans out] and put them on the form.

The formuals would be Trim([Check in])
 and Trim ([check out])

Then use those field in your form rule.  I'm thinking that somehow there are some invisible spaces getting into one of the fields that you are not seeing.. The Trim ( ) function will trim those out.
Photo of Derek

Derek

  • 30 Points
Thanks I'll give that a try
Photo of Derek

Derek

  • 30 Points
Hi I need more assistance.  I decided to go the route of scanning one item into one field instead of scanning multiple items into one field.  The issue I have now is updating the formula you provided earlier yesterday.

Fields are text:

IF(
Trim([check in1]) <>"", "Returned",
Trim([check out1])<>"", "Shipped", "Requested")

Now that I have three fields would the formula be something like this?

IF(
Trim([check in1]) <>"", "Returned",
Trim([check out1])<>"", "Shipped", "Requested",
Trim([check in2]) <>"", "Returned",
Trim([check out2])<>"", "Shipped", "Requested",
Trim([check in3]) <>"", "Returned",
Trim([check out3])<>"", "Shipped", "Requested")
We may be getting beyond what I can help you with in this forum, but I'm willing to go a bit further.

You need to tell me in words what you want. never mind the code for now.  So if they check out three scans and only two come back - what is your status?  Also I still do not understand why there are three scans.  Why cant each check in and check out be separate - why three cans on a single checkout.  What if they don't return the third scanned item?