Jump to content

karl Jonson

Members
  • Content Count

    24
  • Joined

  • Last visited

Everything posted by karl Jonson

  1. Hi, This code not giving the result I'm expecting ? TRegEx.IsMatch(anyStr, '[A-Za-z0-9]{1,5}') Ab123 gives true Ab123456 gives true I expected Ab12345 would give false because input is longer than 5 Why ///Ab123456 is giving true ? I expected result to be false as /// don't match pattern ! TIA
  2. Hi, I am reading a database & adding to a file the following info: user_name, surname, date of birth, phone number One customer can have multiple records in db. Which is the best way to keep track of data I am adding to text file & make sure the data I am copying in it is unique Loop through records in db if combination user_name, surname, date of birth, phone number doesn't exist in text file then add else read next record TIA
  3. Hi, I have similar student data: FirstName LastName DOB DegreeType Course1 Course1StartDate Course2EndDate Also, I have rules similar to these: FirstName does not match pattern LastName does not match pattern Student age cannot be greater than 110 or less than 15 A language degree must have a least one language course A language course cannot be given for a non-laguage degree Course start date can't be after end date These are just examples. I have about 100 data fields & 50 rules. Which is the best way to validate student data against these rules ? If student data is valid add to xml if not then add to a list or erroneous records. TIA
  4. I have this procedure: procedure FindDuplicate(Qry : TADOQuery); The Qry contains just 1 column: "Codes" Which the most efficient way to check that "Codes" column doesn't contain any duplicates ? TIA
  5. Hi, I am trying to process results to this question: What optional subjects do you study? Results could be: 1 Option1 2 Option2 8 None 9 NotKnown I have the results in a SQL query result e.g. OptionCode 1 2 9 I would like to implement these rules on the query result: If duplicate codes then invalid result if 8 & another code then invalid result if 9 & another code then invalid result [Options table] 1 Option1 2 Option2 8 None 9 NotKnown [Answers table] Student Answer 100 1 100 2 101 1 101 9 Student 100 answers are valid. Student 101 answers are not valid because they break rule number3 Which is the best way to implement these 3 rules ? I want to do this: ValidateStudentAnswers(100) => result : valid ValidateStudentAnswers(101) => result : not valid TIA
  6. karl Jonson

    Validation SQL query result

    I would like to do this: ValidateStudentAnswers(100) => result : valid ValidateStudentAnswers(101) => result : not valid
  7. karl Jonson

    Implement logic in TListView

    Hi, If I had these options in TListView: None Not Known OptionOne OptionTwo Which is the best way to implement this logic: 'None' option cannot be selected in conjunction with another options 'Not Known' option cannot be selected in conjunction with another options TIA
  8. karl Jonson

    Defining a path variable in Seattle

    Hi, I downloaded a project which when I open it in Seattle it has in project options in output directory this: $(LocalEXE) It looks that it needs to link to C:\Project\DMS folder. How do I define $(LocalEXE) to point to DMS ? TIA
  9. karl Jonson

    XML validation

    XML validation. I have an Object Pascal application which generates XML similar to this one: <book> <name>Anna Karenina</name> <author>Leo Tolstoy</author> <publisher>The Russian Messenger</publisher> <price>$16.79</price> </book> Which is the best way to add code which validates the above XML (in the generating app) ? I would like to make sure that: A book must have an author. A book price cannot exceed $100 TIA
  10. karl Jonson

    XML validation

    These are the steps I had in mind: User clicks on "Generate XML" button App generates XML App validates XML A report containing errors is generated & displayed to user User goes through errors report, correct their data, then click on "Generate XML" again.
  11. karl Jonson

    XML validation

    There's no reason. That's something I need to consider. These are the steps I had in mind: User clicks on "Generate XML" button App generates XML App validates XML A report containing errors is generated & displayed to user User goes through errors report, correct their data, then click on "Generate XML" again.
  12. karl Jonson

    XML validation

    I would like to validate the XML in the generating app but not against an XSD schema. So my app generates the XML & as a last step I would like to validate the XML against a list of rules, e.g. A book must have an author. A book price cannot exceed $100 A book publisher must exist in a pre-defined list. A book ISBN must be unique .... Then generate a report at the end of validation which lists all errors found. Thanks.
  13. karl Jonson

    comma separated values in DBEdit

    I have a DBEdit linked to a integer-field in a table & everything works fine but now I'd like to allow user to enter many integers separated by commas in the DBEdit. So when user types 1,2,3 three records are inserted in the table & without the posting failing. How can I achieve this ? TIA
  14. karl Jonson

    TMemo instead of TLabel

    Hi, I'm using a procedure which uses a TLabel parameter & sets the caption of the label: prcedure GetString(param1: string; param2:string; myLabel: TLabel); Begin myLabel.caption := GetDescription() End Everything works fine & I don't want to break it as it's called from different places. Now I'd like to be able to sometimes pass it TMemo and display multiple lines in the TMemo component: myMemo.lines.Add(GetDescription()); I'd like to be able to say if component is TLabel then do this but if it's TMemo then do that. TIA
  15. karl Jonson

    TListView with check boxes

    Hi, Does anyone have a working logic for Tlistview with checkboxes where a user can multi select options similar to these: None Not Known OptionOne OptionTwo Thanks
  16. karl Jonson

    Multiselection component

    Hi, I'm using a ButtonEdit component to display a code selected by user & I also use a label to display the description of that code. If user clicks on the ButtonEdit a form is launched & user selects 'NGO', NGO will display in the ButtonEdit and description is fetched & displayed in the label next to it: NGO :Non governmental organization This works fine but now I'd like to allow user to multiselect codes. Which component allows me to multiselect codes & display description of those codes ? It's a list of 4 codes & user can select from 1 to 4 codes. Thanks.
  17. karl Jonson

    TortoiseGit with Delphi 10 Seattle

    Hi all, Anyone is using Delphi 10 Seattle with TortoiseGit ? How did you setup your Git screen in Tools\Options\Version Control ? If I add path\TortoiseGit.exe to Git Executable field Seattle hangs ! Thanks
  18. Hi, How can I used TortoiseGit with Delphi 10 to access code in DevOps ? I have installed Git & TortoiseGit. I have generated PAT token in DevOps. I added token to Windows credential manager. Now, which is the best way to use TortoiseGit to fetch code in Azure DevOps & use it Delphi 10 ? Thanks
  19. karl Jonson

    Default value

    Hi, How can I give Index variable in TExample a default value of -1 ? TExample = class Index : integer; end TIA
  20. karl Jonson

    String into TArray<Byte>

    Hi, What is the best way to convert string 'ABC' into TArray<Byte> ? TIA
  21. karl Jonson

    Hex2Binary

    Hi, What's the best method to convert hexadecimal (e.g. F0) to binary (e.g. 11110000) ? Thank you.
  22. Hi, I would like to compare byte array to ansichar. If MyByteArray = MyansiChar then ... Which is the best method to do that ? TA
  23. karl Jonson

    Compare byte array to ansichar

    Thanks. It's ansichar type. I need to check if MyByteArray = MyansiChar (eg. control character EOT)
  24. karl Jonson

    Compare byte array to ansichar

    The types used are: array[0..12] of Byte system.ansichar TA
×