pub fn amazon_txt_create_vector_of_order_id(rrc: &mut RootRenderingComponent, amazon_txt: &str) {
    log1("amazon_txt_create_vector_of_order_id");
    rrc.amazon_txt = amazon_txt.to_string();

    //https://docs.rs/csv/1.0.7/csv/tutorial/index.html#reading-with-serde
    let mut rdr = csv::ReaderBuilder::new()
        .has_headers(true)
        .delimiter(b'\t')
        .double_quote(false)
        .flexible(true)
        .from_reader(rrc.amazon_txt.as_bytes());

    // The txt can have many documents. One document can have many products.
    // the order-id is important for more products for one document.
    // process can process only 1 document at a time. It means there must be some counter somewhere where
    // the user can choose which document to process.
    // maybe I can draw as many buttons as there are documents onclick the button amazon_txt process
    // if there is more than one document. If there is only one document that process it.

    //first I need a vector of Records. Then I can do all other manipulations.
    let mut vec_rec: Vec<Record> = Vec::new();

    for result in rdr.deserialize() {
        let record: Record = unwrap!(result);
        vec_rec.push(record);
    }
    rrc.vec_rec = vec_rec;

    //now I need a vector of order_id
    let mut vec_order_id: Vec<String> = Vec::new();
    let mut old_order_id = "".to_string();
    for record in &rrc.vec_rec {
        for rec_field in record {
            if rec_field.0 == "order-id" && rec_field.1.clone() != old_order_id {
                vec_order_id.push(rec_field.1.clone());
                old_order_id = rec_field.1.clone();
            }
        }
    }

    rrc.vec_order_id = vec_order_id;
}
///extract a vector of order_id to draw buttons for processing only one order
extract a vector of order_id to draw buttons for processing only one order
extract a vector of order_id to draw buttons for processing only one order
pub fn amazon_txt_create_vector_of_order_id(rrc: &mut RootRenderingComponent, amazon_txt: &str) {
    log1("amazon_txt_create_vector_of_order_id");
    rrc.amazon_txt = amazon_txt.to_string();
    //https://docs.rs/csv/1.0.7/csv/tutorial/index.html#reading-with-serde
    let mut rdr = csv::ReaderBuilder::new()
        .has_headers(true)
        .delimiter(b'\t')
        .double_quote(false)
        .flexible(true)
        .from_reader(rrc.amazon_txt.as_bytes());
    // The txt can have many documents. One document can have many products.
    // the order-id is important for more products for one document.
    // process can process only 1 document at a time. It means there must be some counter somewhere where
    // the user can choose which document to process.
    // maybe I can draw as many buttons as there are documents onclick the button amazon_txt process
    // if there is more than one document. If there is only one document that process it.
    //first I need a vector of Records. Then I can do all other manipulations.
    let mut vec_rec: Vec<Record> = Vec::new();
    for result in rdr.deserialize() {
        let record: Record = unwrap!(result);
        vec_rec.push(record);
    }
    rrc.vec_rec = vec_rec;
    //now I need a vector of order_id
    let mut vec_order_id: Vec<String> = Vec::new();
    let mut old_order_id = "".to_string();
    for record in &rrc.vec_rec {
        for rec_field in record {
            if rec_field.0 == "order-id" && rec_field.1.clone() != old_order_id {
                vec_order_id.push(rec_field.1.clone());
                old_order_id = rec_field.1.clone();
            }
        }
    }
    rrc.vec_order_id = vec_order_id;
}
pub fn amazon_txt_create_vector_of_order_id ( rrc : & mut RootRenderingComponent , amazon_txt : & str ) { log1 ( " " ) ; rrc . amazon_txt = amazon_txt . to_string ( ) ; //https://docs.rs/csv/1.0.7/csv/tutorial/index.html#reading-with-serde let mut rdr = csv :: ReaderBuilder :: new ( ) . has_headers ( true ) . delimiter ( b'\t' ) . double_quote ( false ) . flexible ( true ) . from_reader ( rrc . amazon_txt . as_bytes ( ) ) ; // The txt can have many documents. One document can have many products. // the order-id is important for more products for one document. // process can process only 1 document at a time. It means there must be some counter somewhere where // the user can choose which document to process. // maybe I can draw as many buttons as there are documents onclick the button amazon_txt process // if there is more than one document. If there is only one document that process it. //first I need a vector of Records. Then I can do all other manipulations. let mut vec_rec : Vec < Record > = Vec :: new ( ) ; for result in rdr . deserialize ( ) { let record : Record = unwrap ! ( result ) ; vec_rec . push ( record ) ; } rrc . vec_rec = vec_rec ; //now I need a vector of order_id let mut vec_order_id : Vec < String > = Vec :: new ( ) ; let mut old_order_id = " " . to_string ( ) ; for record in & rrc . vec_rec { for rec_field in record { if rec_field . 0 == " " && rec_field . 1 . clone ( ) != old_order_id { vec_order_id . push ( rec_field . 1 . clone ( ) ) ; old_order_id = rec_field . 1 . clone ( ) ; } } } rrc . vec_order_id = vec_order_id ; }
extract a vector of order_id to draw buttons for processing only one order
extract a vector of order_id to draw buttons for processing only one order
rrc
&mut RootRenderingComponent
amazon_txt
&str