LasseJ Posted November 4, 2011 Posted November 4, 2011 Dear friends, I am importing data from Excel, where I only need part of the data to make it match a look up. Since I am a newbie it is bit hard to explain, but here is an example: I have data saying; 'Yes, I hereby confirm that I will pay 9.000 $' 'Yes, I hereby confirm that I will pay 7.000 $' 'No, I will not pay 7.000 $' 'No, I will not pay 12.000 $' My problem I need it to be either 'Yes' or 'No' to match a look up later in the script. Can anybody help?
bcooney Posted November 4, 2011 Posted November 4, 2011 Is the imported data truly that consistent? If so, you can import that data into a text field, and create a calc field, flag_Pay = if (leftwords (textfield, 1); 1; ""). I usually don't do Yes/No, but rather just Yes, and yes = 1 in a flag field.
comment Posted November 4, 2011 Posted November 4, 2011 I need it to be either 'Yes' or 'No' to match a look up later in the script. You could set the target field to auto-enter a calculated value (replacing existing value) = LeftWords ( Self ; 1 ) and perform auto-enter options during the import. if (leftwords (textfield, 1); 1; "") That would have worked in version 6, I believe. Nowadays, you'd need = LeftWords ( Textfield ; 1 ) = "Yes" to convert the imported values to Boolean.
bcooney Posted November 4, 2011 Posted November 4, 2011 I'd rather not convert imported values. I'd rather reference them in a new calc field (or auto-calc field).
LasseJ Posted November 9, 2011 Author Posted November 9, 2011 Dear all Thank you for your help. I tried with your suggestions, but my problem is that the Replace field content" function autoenters on both kind of records regardless if LeftWords ( Textfield ; 1 ) turns out 'Yes' or 'No' I am probably doing something wrong in my script since 'replace field content' is made for all records at the same time and not individually. Any suggestions?
comment Posted November 9, 2011 Posted November 9, 2011 Replace field content" function autoenters on both kind of records regardless if LeftWords ( Textfield ; 1 ) turns out 'Yes' or 'No' It should enter the first word of Textfield - that is either "Yes" or "No", depending on the original content.
LasseJ Posted November 10, 2011 Author Posted November 10, 2011 i still cant make it work. Here is my script, maybe it is easier for you guys to see where the mistake is this way If [LeftWords ( Frivilligkartotek::Ophold med eller uden fly ; 1 ) = "Yes"] Replace field Contents [ Frivilligkartotek::Ophold med eller uden fly ; 1 ) = "Yes"] Else If [LeftWords ( Frivilligkartotek::Ophold med eller uden fly ; 1 ) = "No"] Replace field Contents [ Frivilligkartotek::Ophold med eller uden fly ; 1 ) = "No"] End if Hopefully this will help you help me :)
comment Posted November 10, 2011 Posted November 10, 2011 The mistake is that if the current record's field starts with "Yes", you replace all records with "Yes". At least that's what I think you do - that's not a real script, is it? You need to make the calculation for each record, as you replace the contents: Replace Field Contents [ Frivilligkartotek::Ophold med eller uden fly ; LeftWords ( Frivilligkartotek::Ophold med eller uden fly ; 1 ) ]
LasseJ Posted November 11, 2011 Author Posted November 11, 2011 Jezz...! Have done it all wrong. Thank you (once again), Comment. ! It works fine now
Recommended Posts
This topic is 4780 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now